2020-11-23 15:59:06 +00:00
|
|
|
# Build the project
|
2023-01-30 19:17:24 +00:00
|
|
|
FROM clux/muslrust:1.67.0 as builder
|
2020-06-12 13:29:50 +00:00
|
|
|
|
2020-10-26 22:32:50 +00:00
|
|
|
ARG CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
|
|
|
|
ARG RUSTRELEASEDIR="release"
|
|
|
|
|
2020-11-23 15:59:06 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
COPY ./ ./
|
|
|
|
|
2021-04-12 11:47:58 +00:00
|
|
|
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
|
2020-06-14 20:36:18 +00:00
|
|
|
RUN cargo build --release
|
2020-06-12 13:29:50 +00:00
|
|
|
|
2020-11-23 15:59:06 +00:00
|
|
|
RUN cp ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server /app/lemmy_server
|
2020-06-14 20:36:18 +00:00
|
|
|
|
2020-11-23 15:59:06 +00:00
|
|
|
# The alpine runner
|
2021-09-02 11:50:20 +00:00
|
|
|
FROM alpine:3 as lemmy
|
2020-06-12 13:29:50 +00:00
|
|
|
|
|
|
|
# Install libpq for postgres
|
2023-01-30 19:17:24 +00:00
|
|
|
RUN apk update && apk add libpq
|
2020-07-29 13:02:46 +00:00
|
|
|
|
2020-06-12 13:29:50 +00:00
|
|
|
# Copy resources
|
2021-11-09 22:16:59 +00:00
|
|
|
COPY --from=builder /app/lemmy_server /app/lemmy
|
2020-06-12 13:29:50 +00:00
|
|
|
|
|
|
|
EXPOSE 8536
|
|
|
|
CMD ["/app/lemmy"]
|