Container pipeline overhaul (#59)

* Simplified docker image building

* minor name fix

* Optimize container pipeline

* Change config to redlib-org account

* Added README push to Quay.io

* Fixes
This commit is contained in:
nohoster 2024-03-04 19:02:06 -06:00 committed by GitHub
parent 5de171b13a
commit 3f4526debe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 181 additions and 147 deletions

View file

@ -1,29 +1,12 @@
####################################################################################################
## Builder
####################################################################################################
FROM rust:alpine AS builder
FROM alpine:3.19
RUN apk add --no-cache musl-dev
ARG TARGET
WORKDIR /redlib
RUN apk add --no-cache curl
COPY . .
RUN curl -L https://github.com/redlib-org/redlib/releases/latest/download/redlib-${TARGET}.tar.gz | \
tar xz -C /usr/local/bin/
RUN cargo build --target x86_64-unknown-linux-musl --release
####################################################################################################
## Final image
####################################################################################################
FROM alpine:latest
# Import ca-certificates from builder
COPY --from=builder /usr/share/ca-certificates /usr/share/ca-certificates
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
# Copy our build
COPY --from=builder /redlib/target/x86_64-unknown-linux-musl/release/redlib /usr/local/bin/redlib
# Use an unprivileged user.
RUN adduser --home /nonexistent --no-create-home --disabled-password redlib
USER redlib
@ -33,4 +16,5 @@ EXPOSE 8080
# Run a healthcheck every minute to make sure redlib is functional
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider --q http://localhost:8080/settings || exit 1
CMD ["redlib"]
CMD ["redlib"]