gluetun-qbit-port-updater/Dockerfile

49 lines
1.1 KiB
Docker
Raw Permalink Normal View History

2023-12-14 01:06:39 +00:00
FROM rust:alpine3.18 as builder
2023-12-14 00:36:36 +00:00
# update packages
RUN apk update
2023-12-14 01:06:39 +00:00
RUN apk add build-base pkgconfig libressl-dev
2023-12-14 00:36:36 +00:00
# Install rust toolchains
RUN rustup toolchain install stable
RUN rustup default stable
# Build dependencies only. Separate these for caches
RUN cargo install cargo-build-deps
# Copy application now
WORKDIR /app
COPY ./ /app
RUN cargo build-deps --release
# Build the release executable.
RUN cargo build --release
# Runner stage.
FROM alpine
2024-05-19 14:14:20 +00:00
RUN apk update \
&& apk add --no-cache \
curl \
catatonit \
&& rm -rf \
/root/.cache \
/tmp/*
2023-12-14 03:24:29 +00:00
2023-12-14 00:36:36 +00:00
ARG UNAME=port_updater
ARG UID=1000
ARG GID=1000
# Add user and copy the executable from the build stage.
RUN adduser --disabled-password --gecos "" $UNAME -s -G $GID -u $UID
COPY --from=builder --chown=$UID:$GID /app/target/release/gluetun-qbit-port-updater /app/gluetun-qbit-port-updater
USER $UNAME
WORKDIR /app
2024-05-19 14:14:20 +00:00
ENTRYPOINT ["/usr/bin/catatonit", "--"]
CMD ["/app/gluetun-qbit-port-updater"]
LABEL org.opencontainers.image.source="https://git.seanomik.net/SeanOMik/gluetun-qbit-port-updater"