Skip to content

Commit

Permalink
Merge pull request apache#9 from aljoscha/hacking-job-server
Browse files Browse the repository at this point in the history
Bake python sdk into python worker image
  • Loading branch information
axelmagn authored Mar 13, 2018
2 parents 0ac2ead + 174e8b4 commit 24dff20
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sdks/python/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ apply plugin: "base"
task test {}
check.dependsOn test

configurations {
main
}

task setupTest {
doLast {
exec {
Expand Down Expand Up @@ -97,3 +101,12 @@ task testPython (dependsOn: 'setupTest') {
}
}
test.dependsOn testPython

def sdist_file = file('dist/apache-beam-2.5.0.dev0.tar.gz')

artifacts {
main(sdist_file) {
name 'apache-beam-python-sdist'
builtBy sdist
}
}
6 changes: 6 additions & 0 deletions sdks/python/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ RUN \
# Check that the fast implementation of protobuf is used.
python -c "from google.protobuf.internal import api_implementation; assert api_implementation._default_implementation_type == 'cpp'; print 'Verified fast protobuf used.'"

ADD target/apache-beam.tar.gz /opt/apache/beam/tars/

RUN \
cd /opt/apache/beam/tars/* && \
python setup.py install

ADD target/linux_amd64/boot /opt/apache/beam/

ENTRYPOINT ["/opt/apache/beam/boot"]
14 changes: 14 additions & 0 deletions sdks/python/container/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,26 @@ description = "Apache Beam :: SDKs :: Python :: Container"
// "./github.com/apache/beam/sdks/go"
resolveBuildDependencies.dependsOn ":sdks:go:build"

configurations {
dockerDependency
}

dependencies {
golang {
// TODO(herohde): use "./" prefix to prevent gogradle use base github path, for now.
// TODO(herohde): get the pkg subdirectory only, if possible. We spend mins pulling cmd/beamctl deps.
build name: './github.com/apache/beam/sdks/go', dir: project(':sdks:go').projectDir
test name: './github.com/apache/beam/sdks/go', dir: project(':sdks:go').projectDir
}

dockerDependency project(path: ":sdks:python", configuration: "main")
}

task copyDockerfileDependencies(type: Copy) {
from configurations.dockerDependency
// rename "apache-beam.*\\.tar.gz", "apache-beam.tar.gz"
rename "apache-beam-2.5.0.dev0.tar.gz", "apache-beam.tar.gz"
into "build/target"
}

golang {
Expand All @@ -57,3 +70,4 @@ docker {
}
// Ensure that making the docker image builds any required artifacts
dockerPrepare.dependsOn build
dockerPrepare.dependsOn copyDockerfileDependencies

0 comments on commit 24dff20

Please sign in to comment.