lemmy/docker/prod/Dockerfile

30 lines
650 B
Docker
Raw Normal View History

# Build the project
FROM clux/muslrust:1.59.0 as builder
2020-06-12 09:29:50 -04:00
2020-10-26 18:32:50 -04:00
ARG CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
ARG RUSTRELEASEDIR="release"
WORKDIR /app
COPY ./ ./
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
2020-06-14 16:36:18 -04:00
RUN cargo build --release
2020-06-12 09:29:50 -04:00
# reduce binary size
2020-06-14 16:36:18 -04:00
RUN strip ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server
2020-06-12 09:29:50 -04:00
RUN cp ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server /app/lemmy_server
2020-06-14 16:36:18 -04:00
# The alpine runner
FROM alpine:3 as lemmy
2020-06-12 09:29:50 -04:00
# Install libpq for postgres
RUN apk add libpq
2020-06-12 09:29:50 -04:00
# Copy resources
2021-11-09 17:16:59 -05:00
COPY --from=builder /app/lemmy_server /app/lemmy
2020-06-12 09:29:50 -04:00
EXPOSE 8536
CMD ["/app/lemmy"]