Skip to content

Commit

Permalink
Merge pull request #16 from Angelin01/dockerfile
Browse files Browse the repository at this point in the history
Add Containerfile
  • Loading branch information
Angelin01 authored Dec 1, 2023
2 parents 014469b + 33320ee commit f58079f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ jobs:
- uses: Swatinem/rust-cache@v2
- run: cargo build --locked --verbose
- run: cargo test --locked
image-build:
name: Build the container image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: docker build . --file Containerfile --tag pod-director:$(date +%s)
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ indoc = "2.0.4"
serde_json = "1.0.108"
tower = "0.4.13"
hyper = "0.14.27"

[profile.release]
strip = "debuginfo"
lto = "fat"
27 changes: 27 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM rust:1.74.0-alpine3.18 as builder

WORKDIR /build

RUN apk add --no-cache musl-dev=1.2.4-r2

COPY .cargo .
COPY Cargo* ./

RUN mkdir -p src && \
touch src/lib.rs && \
cargo build --release --locked --target=x86_64-unknown-linux-musl

COPY src src/

RUN cargo build --release --locked --target=x86_64-unknown-linux-musl

FROM alpine:3.18.4

WORKDIR /app

RUN apk add --no-cache tini=0.19.0-r1

COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/pod-director .

ENTRYPOINT ["tini", "--"]
CMD ["./pod-director"]

0 comments on commit f58079f

Please sign in to comment.