Heavily customized version of smokesignal - https://whtwnd.com/kayrozen.com/3lpwe4ymowg2t
1# syntax=docker/dockerfile:1.4
2FROM rust:latest AS build
3
4RUN cargo install sqlx-cli@0.8.2 --no-default-features --features postgres
5RUN cargo install sccache --version ^0.8
6ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache
7
8RUN USER=root cargo new --bin smokesignal
9RUN mkdir -p /app/
10WORKDIR /app/
11
12RUN --mount=type=bind,source=src,target=src \
13 --mount=type=bind,source=migrations,target=migrations \
14 --mount=type=bind,source=static,target=static \
15 --mount=type=bind,source=i18n,target=i18n \
16 --mount=type=bind,source=templates,target=templates \
17 --mount=type=bind,source=build.rs,target=build.rs \
18 --mount=type=bind,source=Cargo.toml,target=Cargo.toml \
19 --mount=type=bind,source=Cargo.lock,target=Cargo.lock \
20 --mount=type=cache,target=/app/target/ \
21 --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
22 --mount=type=cache,target=/usr/local/cargo/registry/ \
23 <<EOF
24set -e
25cargo build --locked --release --bin smokesignal --target-dir . --no-default-features -F embed
26EOF
27
28RUN groupadd -g 1500 -r smokesignal && useradd -u 1501 -r -g smokesignal -d /var/lib/smokesignal -m smokesignal
29RUN chown -R smokesignal:smokesignal /app/release/smokesignal
30
31FROM gcr.io/distroless/cc
32
33LABEL org.opencontainers.image.title="Smoke Signal"
34LABEL org.opencontainers.image.description="An event and RSVP management application."
35LABEL org.opencontainers.image.licenses="MIT"
36LABEL org.opencontainers.image.authors="Nick Gerakines <nick.gerakines@gmail.com>"
37LABEL org.opencontainers.image.source="https://tangled.sh/@smokesignal.events/smokesignal"
38LABEL org.opencontainers.image.version="1.0.2"
39
40WORKDIR /var/lib/smokesignal
41USER smokesignal:smokesignal
42
43COPY --from=build /etc/passwd /etc/passwd
44COPY --from=build /etc/group /etc/group
45COPY --from=build /app/release/smokesignal /var/lib/smokesignal/
46COPY static /var/lib/smokesignal/static
47
48ENV HTTP_STATIC_PATH=/var/lib/smokesignal/static
49
50ENV RUST_LOG=info
51ENV RUST_BACKTRACE=full
52
53ENTRYPOINT ["/var/lib/smokesignal/smokesignal"]