Skip to content

[BLD] [REVERT]: unify Rust Dockerfiles for faster builds #4543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/actions/docker/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ description: "This action sets up Docker Buildx and authenticates to registries"
inputs:
ghcr-username:
description: "Github Container Registry username"
required: false
required: true
ghcr-password:
description: "Github Container Registry password"
required: false
required: true
dockerhub-username:
description: "DockerHub username"
required: true
Expand All @@ -26,7 +26,6 @@ runs:
uses: docker/setup-buildx-action@v2
- name: Log in to the Github Container registry
uses: docker/[email protected]
if: ${{ inputs.ghcr-username != '' }}
with:
registry: ghcr.io
username: ${{ inputs.ghcr-username }}
Expand All @@ -36,6 +35,3 @@ runs:
with:
username: ${{ inputs.dockerhub-username }}
password: ${{ inputs.dockerhub-password }}
- uses: useblacksmith/[email protected]
with:
setup-only: true
3 changes: 1 addition & 2 deletions .github/workflows/_build_release_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ jobs:
uses: useblacksmith/[email protected]
with:
context: .
file: rust/Dockerfile
target: cli
file: rust/cli/Dockerfile
platforms: ${{ env.PLATFORMS }}
push: true
build-args: |
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/_go-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ jobs:
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/go
- name: Set up Docker
uses: ./.github/actions/docker
- uses: useblacksmith/[email protected]
with:
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}
setup-only: true
- uses: ./.github/actions/tilt
- run: bin/cluster-test.sh bash -c 'cd go && make test'
- name: Save service logs to artifact
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/_python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,9 @@ jobs:
# languages: python
# api_key: ${{ secrets.DD_API_KEY }}
# site: ${{ vars.DD_SITE }}
- name: Set up Docker
uses: ./.github/actions/docker
- uses: useblacksmith/[email protected]
with:
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}
setup-only: true
- uses: ./.github/actions/tilt
- name: Test
run: bin/cluster-test.sh bash -c 'python -m pytest "${{ matrix.test-globs }}"' --durations 10
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/_rust-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,9 @@ jobs:
uses: ./.github/actions/rust
with:
github-token: ${{ github.token }}
- name: Set up Docker
uses: ./.github/actions/docker
- uses: useblacksmith/[email protected]
with:
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}
setup-only: true
- name: Start services in Tilt
uses: ./.github/actions/tilt
- name: Build CLI
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ jobs:
needs: change-detection
if: contains(fromJson(needs.change-detection.outputs.tests-to-run), 'go')
uses: ./.github/workflows/_go-tests.yml
secrets: inherit

check-title:
name: Check PR Title
Expand Down
22 changes: 10 additions & 12 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,15 @@ else:
if config.tilt_subcommand == "ci":
custom_build(
'rust-log-service',
'docker buildx build --load -t $EXPECTED_REF --target=log_service -f ./rust/Dockerfile .',
'docker buildx build --load -t $EXPECTED_REF -f ./rust/log-service/Dockerfile .',
['./rust/', './idl/', './Cargo.toml', './Cargo.lock']
)
else:
docker_build(
'rust-log-service',
'.',
only=["rust/", "idl/", "Cargo.toml", "Cargo.lock"],
dockerfile='./rust/Dockerfile',
target='log_service'
dockerfile='./rust/log-service/Dockerfile',
)

if config.tilt_subcommand == "ci":
Expand Down Expand Up @@ -85,60 +84,59 @@ else:
if config.tilt_subcommand == "ci":
custom_build(
'rust-frontend-service',
'docker buildx build --load -t $EXPECTED_REF -f ./rust/Dockerfile --target cli . ',
'docker buildx build --load -t $EXPECTED_REF -f ./rust/cli/Dockerfile . ',
['./rust/', './idl/', './Cargo.toml', './Cargo.lock']
)
else:
docker_build(
'rust-frontend-service',
'.',
only=["rust/", "idl/", "Cargo.toml", "Cargo.lock"],
dockerfile='./rust/Dockerfile',
target='cli'
dockerfile='./rust/cli/Dockerfile',
)

if config.tilt_subcommand == "ci":
custom_build(
'query-service',
'docker buildx build --load -t $EXPECTED_REF --target query_service -f ./rust/Dockerfile .',
'docker buildx build --load -t $EXPECTED_REF --target query_service -f ./rust/worker/Dockerfile .',
['./rust/', './idl/', './Cargo.toml', './Cargo.lock']
)
else:
docker_build(
'query-service',
'.',
only=["rust/", "idl/", "Cargo.toml", "Cargo.lock"],
dockerfile='./rust/Dockerfile',
dockerfile='./rust/worker/Dockerfile',
target='query_service'
)

if config.tilt_subcommand == "ci":
custom_build(
'compaction-service',
'docker buildx build --load -t $EXPECTED_REF --target compaction_service -f ./rust/Dockerfile .',
'docker buildx build --load -t $EXPECTED_REF --target compaction_service -f ./rust/worker/Dockerfile .',
['./rust/', './idl/', './Cargo.toml', './Cargo.lock']
)
else:
docker_build(
'compaction-service',
'.',
only=["rust/", "idl/", "Cargo.toml", "Cargo.lock"],
dockerfile='./rust/Dockerfile',
dockerfile='./rust/worker/Dockerfile',
target='compaction_service'
)

if config.tilt_subcommand == "ci":
custom_build(
'garbage-collector',
'docker buildx build --load -t $EXPECTED_REF --target garbage_collector -f ./rust/Dockerfile .',
'docker buildx build --load -t $EXPECTED_REF --target garbage_collector -f ./rust/garbage_collector/Dockerfile .',
['./rust/', './idl/', './Cargo.toml', './Cargo.lock']
)
else:
docker_build(
'garbage-collector',
'.',
only=["rust/", "idl/", "Cargo.toml", "Cargo.lock"],
dockerfile='./rust/Dockerfile',
dockerfile='./rust/garbage_collector/Dockerfile',
target='garbage_collector'
)

Expand Down
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ services:
image: server
build:
context: .
dockerfile: rust/Dockerfile
target: cli
dockerfile: rust/cli/Dockerfile
# Uncomment below to build in release mode
# args:
# RELEASE_MODE: "1"
Expand Down
6 changes: 5 additions & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[toolchain]
# Keep this version in sync with rust/Dockerfile.
# Keep this version in sync with:
# - rust/cli/Dockerfile
# - rust/load/Dockerfile
# - rust/log/Dockerfile
# - rust/worker/Dockerfile
channel = "1.81.0"
components = ["rustfmt", "clippy"]
81 changes: 0 additions & 81 deletions rust/Dockerfile

This file was deleted.

Loading