mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
41b90bb162
* Add console-subscriber * Add larg event buffer capacity * Add console port to lemmy prod container * Expose pict-rs console port * Update pictrs
48 lines
1.1 KiB
Docker
48 lines
1.1 KiB
Docker
ARG RUST_BUILDER_IMAGE=clux/muslrust:1.56.0
|
|
|
|
FROM $RUST_BUILDER_IMAGE as chef
|
|
USER root
|
|
RUN cargo install cargo-chef
|
|
WORKDIR /app
|
|
|
|
# Cargo chef plan
|
|
FROM chef as planner
|
|
ENV RUSTFLAGS="--cfg tokio_unstable"
|
|
|
|
# Copy dirs
|
|
COPY . .
|
|
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
FROM chef as builder
|
|
ARG CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
|
|
ARG RUSTRELEASEDIR="debug"
|
|
ENV RUSTFLAGS="--cfg tokio_unstable"
|
|
|
|
COPY --from=planner /app/recipe.json ./recipe.json
|
|
RUN cargo chef cook --recipe-path recipe.json --target ${CARGO_BUILD_TARGET}
|
|
|
|
# Copy the rest of the dirs
|
|
COPY . .
|
|
|
|
# Build the project
|
|
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
|
|
RUN cargo build --target ${CARGO_BUILD_TARGET}
|
|
|
|
# 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
|
|
|
|
# Copy resources
|
|
COPY --from=builder /app/lemmy_server /app/lemmy
|
|
|
|
EXPOSE 8536
|
|
CMD ["/app/lemmy"]
|