mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-09 01:44:02 +00:00
993489a80f
* Combine prod and dev docker setups using build-arg - Fixes #2603 * Dont use cache for release build.
38 lines
978 B
Docker
38 lines
978 B
Docker
ARG RUST_BUILDER_IMAGE=rust:1.64-slim-buster
|
|
|
|
# Build Lemmy
|
|
FROM $RUST_BUILDER_IMAGE as builder
|
|
|
|
# Install compilation dependencies
|
|
RUN apt-get update \
|
|
&& apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY ./ ./
|
|
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
|
|
|
|
RUN cargo build --release
|
|
|
|
RUN cp ./target/release/lemmy_server /app/lemmy_server
|
|
|
|
# The Debian runner
|
|
FROM debian:buster-slim as lemmy
|
|
|
|
# Install libpq for postgres
|
|
RUN apt-get update \
|
|
&& apt-get -y install --no-install-recommends postgresql-client libc6 libssl1.1 ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN addgroup --gid 1000 lemmy
|
|
RUN useradd --no-create-home --shell /bin/sh --uid 1000 --gid 1000 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"]
|