Fixing cache dev dockerfile

This commit is contained in:
Dessalines 2020-10-27 10:57:40 -05:00
parent 91d073c2e8
commit 77b17c6737

View file

@ -6,7 +6,7 @@ ENV HOME=/home/root
WORKDIR /app WORKDIR /app
# Copy the source folders # Copy the source folders
COPY . . COPY . ./
# Build for debug # Build for debug
RUN --mount=type=cache,target=/usr/local/cargo/registry \ RUN --mount=type=cache,target=/usr/local/cargo/registry \
@ -15,28 +15,21 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
RUN --mount=type=cache,target=/app/target \ RUN --mount=type=cache,target=/app/target \
cp target/debug/lemmy_server lemmy_server cp target/debug/lemmy_server lemmy_server
FROM ekidd/rust-musl-builder:1.47.0 as docs FROM peaceiris/mdbook:v0.3.7 as docs
WORKDIR /app WORKDIR /app
COPY docs ./docs COPY docs ./docs
RUN sudo chown -R rust:rust .
RUN mdbook build docs/ RUN mdbook build docs/
FROM alpine:3.12 FROM ubuntu:20.10
# Install libpq for postgres # Install libpq for postgres and espeak
RUN apk add libpq RUN apt-get update -y
RUN apt-get install -y libpq-dev espeak
# Install Espeak for captchas
RUN apk add espeak
# Copy resources # Copy resources
COPY config/defaults.hjson /config/defaults.hjson COPY config/defaults.hjson /config/defaults.hjson
COPY --from=rust /app/lemmy_server /app/lemmy COPY --from=rust /app/lemmy_server /app/lemmy
COPY --from=docs /app/docs/book/ /app/documentation/ COPY --from=docs /app/docs/book/ /app/documentation/
RUN addgroup -g 1000 lemmy
RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
RUN chown lemmy:lemmy /app/lemmy
USER lemmy
EXPOSE 8536 EXPOSE 8536
CMD ["/app/lemmy"] CMD ["/app/lemmy"]