this repo has no description
1# syntax=docker/dockerfile:1.4
2FROM rust:1-bookworm AS build
3
4RUN cargo install sqlx-cli@0.8.2 --no-default-features --features sqlite
5RUN cargo install sccache --version ^0.8
6ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache
7
8RUN USER=root cargo new --bin supercell
9RUN mkdir -p /app/
10WORKDIR /app/
11
12ARG GIT_HASH
13ENV GIT_HASH=$GIT_HASH
14ARG CARGO_FEATURES
15
16RUN --mount=type=bind,source=src,target=src \
17 --mount=type=bind,source=migrations,target=migrations \
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 supercell --target-dir . --features "$CARGO_FEATURES"
26EOF
27
28FROM debian:bookworm-slim
29
30LABEL org.opencontainers.image.source="https://github.com/astrenoxcoop/supercell"
31LABEL org.opencontainers.image.description="A lightweight and configurable atproto feed generator."
32LABEL org.opencontainers.image.licenses=MIT
33
34RUN set -x \
35 && apt-get update \
36 && apt-get install ca-certificates -y
37
38RUN groupadd -g 1508 -r supercell && useradd -u 1509 -r -g supercell -d /var/lib/supercell -m supercell
39
40ENV RUST_LOG=info
41ENV RUST_BACKTRACE=full
42
43COPY --from=build /app/release/supercell /var/lib/supercell/
44
45RUN chown -R supercell:supercell /var/lib/supercell
46
47WORKDIR /var/lib/supercell
48
49USER supercell
50ENTRYPOINT ["sh", "-c", "/var/lib/supercell/supercell"]