Skip to content

Commit

Permalink
Clean up docker file
Browse files Browse the repository at this point in the history
This commit fixes up the Dockerfile to make it a bit cleaner and remove some cruft
  • Loading branch information
sinkingpoint committed Jul 11, 2022
1 parent 68c637d commit 317e285
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 28 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/
36 changes: 8 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,15 @@
FROM ekidd/rust-musl-builder:stable as builder

WORKDIR /usr/src/app

COPY . .

RUN cargo install --path .

ADD --chown=rust:rust . ./
RUN cargo build --release

FROM alpine:latest as runner

ARG APP=/usr/src/app

ENV TZ=Etc/UTC \
APP_USER=appuser

RUN addgroup -S $APP_USER \
&& adduser -S -g $APP_USER $APP_USER

RUN apk add --no-cache ca-certificates tzdata

WORKDIR ${APP}

COPY --from=builder ${APP}/target/x86_64-unknown-linux-musl/release/gravel-gateway .

RUN chown -R $APP_USER:$APP_USER ${APP}

ARG APP_USER=gravel
RUN addgroup -S $APP_USER && adduser -S -g $APP_USER $APP_USER
COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/gravel-gateway /usr/bin/gravel-gateway
RUN chown -R $APP_USER:$APP_USER /usr/bin/gravel-gateway
USER $APP_USER

EXPOSE 4278

ENTRYPOINT [ "./gravel-gateway", "-l", "0.0.0.0:4278" ]
ENTRYPOINT [ "/usr/bin/gravel-gateway", "-l", "0.0.0.0:4278" ]

HEALTHCHECK --interval=30s --timeout=3s \
CMD wget --spider localhost:4278/metrics
HEALTHCHECK --interval=30s --timeout=3s CMD wget --spider localhost:4278/metrics

0 comments on commit 317e285

Please sign in to comment.