Remove unnecessary steps in dockcer image, use alpine:latest for the 2nd stage
This commit is contained in:
parent
61d14e25a4
commit
6dcfed33c7
10
Dockerfile
10
Dockerfile
|
@ -5,8 +5,8 @@ RUN apk update
|
||||||
RUN apk add build-base ca-certificates libressl-dev
|
RUN apk add build-base ca-certificates libressl-dev
|
||||||
|
|
||||||
# Install rust toolchains
|
# Install rust toolchains
|
||||||
RUN rustup toolchain install stable
|
#RUN rustup toolchain install stable
|
||||||
RUN rustup default stable
|
#RUN rustup default stable
|
||||||
|
|
||||||
# create root application folder
|
# create root application folder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
@ -14,15 +14,15 @@ COPY ./ /app/src
|
||||||
WORKDIR /app/src
|
WORKDIR /app/src
|
||||||
|
|
||||||
# Build dependencies only. Separate these for caches
|
# Build dependencies only. Separate these for caches
|
||||||
RUN cargo install cargo-build-deps
|
#RUN cargo install cargo-build-deps
|
||||||
RUN sh -c "cargo build-deps --release"
|
#RUN sh -c "cargo build-deps --release"
|
||||||
|
|
||||||
# Build the release executable.
|
# Build the release executable.
|
||||||
RUN sh -c "cargo build --release"
|
RUN sh -c "cargo build --release"
|
||||||
|
|
||||||
# Runner stage. I tried using distroless (gcr.io/distroless/static-debian11), but the image was only ~3MBs smaller than
|
# Runner stage. I tried using distroless (gcr.io/distroless/static-debian11), but the image was only ~3MBs smaller than
|
||||||
# alpine. I chose to use alpine since it makes it easier to exec into the container to debug things.
|
# alpine. I chose to use alpine since it makes it easier to exec into the container to debug things.
|
||||||
FROM rust:1.75-alpine
|
FROM alpine:latest
|
||||||
|
|
||||||
ARG UNAME=exporter
|
ARG UNAME=exporter
|
||||||
ARG UID=1000
|
ARG UID=1000
|
||||||
|
|
Loading…
Reference in New Issue