Skip to content

Commit

Permalink
Extend Dockerfile to allow specifying which features are built
Browse files Browse the repository at this point in the history
This closes #2201.
  • Loading branch information
tillrohrmann committed Nov 4, 2024
1 parent c1f742a commit 19e630f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ on:
required: false
default: false
type: boolean
features:
description: 'features to enable in the build'
required: false
default: ''
type: string
pushToDockerHub:
description: 'push image to DockerHub'
required: false
Expand Down Expand Up @@ -117,6 +122,7 @@ jobs:
ACTIONS_CACHE_URL=http://127.0.0.1:49160/
ACTIONS_RUNTIME_TOKEN
SCCACHE_GHA_ENABLED=true
RESTATE_FEATURES=${{ inputs.features || '' }}
cache-from: type=gha,scope=${{ github.workflow }},url=http://127.0.0.1:49160/
cache-to: type=gha,mode=max,scope=${{ github.workflow }},url=http://127.0.0.1:49160/

Expand Down Expand Up @@ -154,5 +160,6 @@ jobs:
ACTIONS_CACHE_URL=http://127.0.0.1:49160/
ACTIONS_RUNTIME_TOKEN
SCCACHE_GHA_ENABLED=true
RESTATE_FEATURES=${{ inputs.features || '' }}
cache-from: type=gha,scope=${{ github.workflow }},url=http://127.0.0.1:49160/
cache-to: type=gha,mode=max,scope=${{ github.workflow }},url=http://127.0.0.1:49160/
5 changes: 3 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ ARG SCCACHE_GHA_ENABLED=''
# Overrides the behaviour of the release profile re including debug symbols, which in our repo is not to include them.
# Should be set to 'false' or 'true'. See https://doc.rust-lang.org/cargo/reference/environment-variables.html
ARG CARGO_PROFILE_RELEASE_DEBUG=false
ARG RESTATE_FEATURES=''
# Caching layer if nothing has changed
# Only build restate binary to avoid compiling unneeded crates
RUN just arch=$TARGETARCH libc=gnu chef-cook --release --bin restate-server
RUN just arch=$TARGETARCH libc=gnu features=$RESTATE_FEATURES chef-cook --release --bin restate-server
COPY . .
RUN just arch=$TARGETARCH libc=gnu build --release --bin restate-server && \
RUN just arch=$TARGETARCH libc=gnu features=$RESTATE_FEATURES build --release --bin restate-server && \
just notice-file && \
mv target/$(just arch=$TARGETARCH libc=gnu print-target)/release/restate-server target/restate-server

Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ verify: lint test doctest
docker:
# podman builds do not work without --platform set, even though it claims to default to host arch
docker buildx build . --platform linux/{{ _docker_arch }} --file docker/Dockerfile --tag={{ docker_image }} --progress='{{ DOCKER_PROGRESS }}' --load
docker buildx build . --platform linux/{{ _docker_arch }} --file docker/Dockerfile --tag={{ docker_image }} --progress='{{ DOCKER_PROGRESS }}' --build-arg RESTATE_FEATURES={{ features }} --load
notice-file:
cargo license -d -a --avoid-build-deps --avoid-dev-deps {{ _features }} | (echo "Restate Runtime\nCopyright (c) 2024 Restate Software, Inc., Restate GmbH <[email protected]>\n" && cat) > NOTICE
Expand Down

0 comments on commit 19e630f

Please sign in to comment.