diff --git a/.github/workflows/build-push-edge-debug.yaml b/.github/workflows/build-push-edge-debug.yaml index 6fe503bfc..5319bb5bd 100644 --- a/.github/workflows/build-push-edge-debug.yaml +++ b/.github/workflows/build-push-edge-debug.yaml @@ -24,22 +24,24 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v5 with: images: parseable/parseable - name: Build and push - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + uses: docker/build-push-action@v6 with: context: . file: ./Dockerfile.debug push: true tags: parseable/parseable:edge-debug platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/build-push-edge.yaml b/.github/workflows/build-push-edge.yaml index a93e6673e..625976d7a 100644 --- a/.github/workflows/build-push-edge.yaml +++ b/.github/workflows/build-push-edge.yaml @@ -24,22 +24,24 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v5 with: images: parseable/parseable - name: Build and push - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + uses: docker/build-push-action@v6 with: context: . file: ./Dockerfile push: true tags: parseable/parseable:edge platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index 1b6d6f51f..5b7c71af3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ # along with this program. If not, see . # build stage -FROM rust:1.83.0-bookworm as builder +FROM rust:1.83.0-bookworm AS builder LABEL org.opencontainers.image.title="Parseable" LABEL maintainer="Parseable Team " @@ -22,7 +22,13 @@ LABEL org.opencontainers.image.vendor="Parseable Inc" LABEL org.opencontainers.image.licenses="AGPL-3.0" WORKDIR /parseable -COPY . . + +# Cache dependencies +COPY Cargo.toml Cargo.lock build.rs .git ./ +RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo build --release && rm -rf src + +# Build the actual binary +COPY src ./src RUN cargo build --release # final stage @@ -30,7 +36,7 @@ FROM gcr.io/distroless/cc-debian12:latest WORKDIR /parseable -# Copy the static shell into base image. +# Copy the static binary into the final image COPY --from=builder /parseable/target/release/parseable /usr/bin/parseable CMD ["/usr/bin/parseable"] diff --git a/Dockerfile.debug b/Dockerfile.debug index e37c2125c..5c86963fc 100644 --- a/Dockerfile.debug +++ b/Dockerfile.debug @@ -22,7 +22,13 @@ LABEL org.opencontainers.image.vendor="Parseable Inc" LABEL org.opencontainers.image.licenses="AGPL-3.0" WORKDIR /parseable -COPY . . + +# Cache dependencies +COPY Cargo.toml Cargo.lock build.rs .git ./ +RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo build --release && rm -rf src + +# Build the actual binary +COPY src ./src RUN cargo build # final stage @@ -30,6 +36,7 @@ FROM docker.io/debian:bookworm-slim WORKDIR /parseable +# Copy the static binary into the final image COPY --from=builder /parseable/target/debug/parseable /usr/bin/parseable CMD ["/usr/bin/parseable"]