2020-10-24 15:23:45 +00:00
|
|
|
# syntax=docker/dockerfile:experimental
|
|
|
|
FROM rust:1.47-buster as rust
|
2019-04-10 18:10:57 +00:00
|
|
|
|
2020-10-24 15:23:45 +00:00
|
|
|
ENV HOME=/home/root
|
2020-09-02 15:42:48 +00:00
|
|
|
|
2020-10-24 15:23:45 +00:00
|
|
|
WORKDIR /app
|
2020-09-02 15:42:48 +00:00
|
|
|
|
2020-10-24 15:23:45 +00:00
|
|
|
# Copy the source folders
|
|
|
|
COPY . .
|
2019-04-10 18:10:57 +00:00
|
|
|
|
2020-06-12 13:29:50 +00:00
|
|
|
# Build for debug
|
2020-10-24 15:23:45 +00:00
|
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|
|
|
--mount=type=cache,target=/app/target \
|
|
|
|
cargo build
|
|
|
|
RUN --mount=type=cache,target=/app/target \
|
|
|
|
cp target/debug/lemmy_server lemmy_server
|
2020-01-01 17:01:49 +00:00
|
|
|
|
2020-10-24 15:23:45 +00:00
|
|
|
FROM ekidd/rust-musl-builder:1.47.0 as docs
|
2020-01-01 17:01:49 +00:00
|
|
|
WORKDIR /app
|
|
|
|
COPY docs ./docs
|
|
|
|
RUN sudo chown -R rust:rust .
|
|
|
|
RUN mdbook build docs/
|
|
|
|
|
2020-06-14 20:36:18 +00:00
|
|
|
FROM alpine:3.12
|
2019-05-14 00:46:29 +00:00
|
|
|
|
|
|
|
# Install libpq for postgres
|
|
|
|
RUN apk add libpq
|
|
|
|
|
2020-07-29 13:02:46 +00:00
|
|
|
# Install Espeak for captchas
|
|
|
|
RUN apk add espeak
|
|
|
|
|
2019-05-14 00:46:29 +00:00
|
|
|
# Copy resources
|
2020-09-15 19:26:47 +00:00
|
|
|
COPY config/defaults.hjson /config/defaults.hjson
|
2020-10-24 15:23:45 +00:00
|
|
|
COPY --from=rust /app/lemmy_server /app/lemmy
|
2020-09-15 19:26:47 +00:00
|
|
|
COPY --from=docs /app/docs/book/ /app/documentation/
|
2019-12-17 21:35:48 +00:00
|
|
|
|
2019-05-14 00:46:29 +00:00
|
|
|
RUN addgroup -g 1000 lemmy
|
|
|
|
RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
|
|
|
|
RUN chown lemmy:lemmy /app/lemmy
|
|
|
|
USER lemmy
|
2019-04-06 23:48:54 +00:00
|
|
|
EXPOSE 8536
|
2019-05-14 00:46:29 +00:00
|
|
|
CMD ["/app/lemmy"]
|