Skip to content

Commit

Permalink
Switch to alpine, add healthcheck command, update rust version, build…
Browse files Browse the repository at this point in the history
… now optimized version.
  • Loading branch information
karlTGA committed May 3, 2024
1 parent dbf8653 commit a370e06
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
FROM rust:1.70.0 as builder
FROM rust:1.78.0-alpine3.19 as builder

WORKDIR /usr/src/rust-tz-service
COPY . .

RUN --mount=type=cache,target=/usr/local/cargo/registry cargo install --path .
RUN apk add libc-dev
RUN --mount=type=cache,target=/usr/local/cargo/registry cargo build --release

FROM debian:bullseye-slim
RUN apt-get update && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/rust-tz-service /usr/local/bin/rust-tz-service
FROM alpine:3.19
RUN apk --no-cache add curl
COPY --from=builder /usr/src/rust-tz-service/target/release/rust-tz-service /usr/local/bin/rust-tz-service

ENV RUST_LOG=info
CMD ["rust-tz-service"]
HEALTHCHECK CMD curl --fail http://localhost:8080/health || exit 1
CMD rust-tz-service

0 comments on commit a370e06

Please sign in to comment.