mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 06:41:18 +00:00
c654aa3416
* Use more generic docker deps. Fixes #1759 * Don't use slim
35 lines
831 B
Docker
35 lines
831 B
Docker
# Build the project
|
|
FROM ekidd/rust-musl-builder:1.51.0 as builder
|
|
|
|
ARG CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
|
|
ARG RUSTRELEASEDIR="release"
|
|
|
|
WORKDIR /app
|
|
|
|
COPY ./ ./
|
|
|
|
RUN sudo chown -R rust:rust .
|
|
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
|
|
RUN cargo build --release
|
|
|
|
# reduce binary size
|
|
RUN strip ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server
|
|
|
|
RUN cp ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server /app/lemmy_server
|
|
|
|
# The alpine runner
|
|
FROM alpine:3 as lemmy
|
|
|
|
# Install libpq for postgres
|
|
RUN apk add libpq
|
|
|
|
RUN addgroup -g 1000 lemmy
|
|
RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
|
|
|
|
# Copy resources
|
|
COPY --chown=lemmy:lemmy --from=builder /app/lemmy_server /app/lemmy
|
|
|
|
RUN chown lemmy:lemmy /app/lemmy
|
|
USER lemmy
|
|
EXPOSE 8536
|
|
CMD ["/app/lemmy"]
|