Skip to content

Commit

Permalink
Add docker build optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Feb 5, 2024
1 parent 98c8d45 commit e968020
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
Expand All @@ -44,3 +55,5 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM rust:1.67.0
# Build Stage
FROM rust:1.67.0 AS builder

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends clang cmake build-essential

Expand All @@ -8,4 +9,11 @@ COPY . .

RUN cargo build --release

ENTRYPOINT ["/bin/bash", "-c", "./target/release/mutinynet-faucet-rs ${FLAGS}"]
# Run Stage
FROM debian:buster-slim

WORKDIR /app

COPY --from=builder /app/target/release/mutinynet-faucet-rs /app/mutinynet-faucet-rs

ENTRYPOINT ["/bin/bash", "-c", "./mutinynet-faucet-rs ${FLAGS}"]

0 comments on commit e968020

Please sign in to comment.