diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e45120051..c6c356711 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -17,6 +17,16 @@ env: VERSION: "1.0.0" jobs: + # Builds images that match what's default in docker-compose.yml for + # local development. + build-dev-images: + uses: ./.github/workflows/_build_artifacts.yml + secrets: inherit + with: + image_prefix: "dev" + stage: "debug" + profile: "debug" + # Re-run CI checks to make sure everything's green, since "Merging as administrator" # won't trigger these in the merge group. ci: diff --git a/docker-compose.yml b/docker-compose.yml index bf7c146f7..5d3c06bba 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -115,14 +115,14 @@ services: FIREZONE_API_URL: ws://api:8081 init: true build: - target: debug + target: dev context: rust dockerfile: Dockerfile cache_from: - type=registry,ref=us-east1-docker.pkg.dev/firezone-staging/cache/client:main args: PACKAGE: firezone-linux-client - image: ${CLIENT_IMAGE:-us-east1-docker.pkg.dev/firezone-staging/firezone/debug/client}:${CLIENT_TAG:-main} + image: ${CLIENT_IMAGE:-us-east1-docker.pkg.dev/firezone-staging/firezone/dev/client}:${CLIENT_TAG:-main} cap_add: - NET_ADMIN sysctls: @@ -146,14 +146,14 @@ services: FIREZONE_API_URL: ws://api:8081 FIREZONE_ID: 4694E56C-7643-4A15-9DF3-638E5B05F570 build: - target: debug + target: dev context: rust dockerfile: Dockerfile cache_from: - type=registry,ref=us-east1-docker.pkg.dev/firezone-staging/cache/gateway:main args: PACKAGE: firezone-gateway - image: ${GATEWAY_IMAGE:-us-east1-docker.pkg.dev/firezone-staging/firezone/debug/gateway}:${GATEWAY_TAG:-main} + image: ${GATEWAY_IMAGE:-us-east1-docker.pkg.dev/firezone-staging/firezone/dev/gateway}:${GATEWAY_TAG:-main} cap_add: - NET_ADMIN sysctls: @@ -212,14 +212,14 @@ services: RUST_BACKTRACE: 1 FIREZONE_API_URL: ws://api:8081 build: - target: debug + target: dev context: rust dockerfile: Dockerfile cache_from: - type=registry,ref=us-east1-docker.pkg.dev/firezone-staging/cache/relay:main args: PACKAGE: firezone-relay - image: ${RELAY_IMAGE:-us-east1-docker.pkg.dev/firezone-staging/firezone/debug/relay}:${RELAY_TAG:-main} + image: ${RELAY_IMAGE:-us-east1-docker.pkg.dev/firezone-staging/firezone/dev/relay}:${RELAY_TAG:-main} healthcheck: test: ["CMD-SHELL", "lsof -i UDP | grep firezone-relay"] start_period: 10s diff --git a/rust/Dockerfile b/rust/Dockerfile index 04048918d..d4c88c056 100644 --- a/rust/Dockerfile +++ b/rust/Dockerfile @@ -125,16 +125,21 @@ ENV PACKAGE=${PACKAGE} CMD $PACKAGE # used for local development -FROM runtime as development +FROM runtime as test RUN set -xe \ && apk add --no-cache iperf3 bind-tools iproute2 jq +# used for local development +FROM test AS dev +ARG TARGET +COPY --from=builder /build/target/${TARGET}/debug/${PACKAGE} . + # Build an image for GitHub Actions which includes debug asserts and test utilities -FROM development AS debug +FROM test AS debug ARG TARGET -## Build first with `cross build --target ${TARGET} -p ${PACKAGE} --debug && mv /target/${TARGET}/release/${PACKAGE} .` +## Build first with `cross build --target ${TARGET} -p ${PACKAGE} && mv /target/${TARGET}/release/${PACKAGE} .` COPY ${PACKAGE} . # Build a production image from including a binary compiled on the host diff --git a/rust/docker-compose-dev.yml b/rust/docker-compose-dev.yml index 9d6c9fb75..d4ca6bd9d 100644 --- a/rust/docker-compose-dev.yml +++ b/rust/docker-compose-dev.yml @@ -2,18 +2,18 @@ services: client: build: - target: development + target: test volumes: - ./rust/target/x86_64-unknown-linux-musl/debug/firezone-linux-client:/bin/firezone-linux-client gateway: build: - target: development + target: test volumes: - ./rust/target/x86_64-unknown-linux-musl/debug/firezone-gateway:/bin/firezone-gateway relay: build: - target: development + target: test volumes: - ./rust/target/x86_64-unknown-linux-musl/debug/firezone-relay:/bin/firezone-relay