-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (32 loc) · 1.46 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM rust:1-bookworm AS build
RUN cargo install [email protected] --no-default-features --features sqlite
RUN cargo install sccache --version ^0.8
ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache
RUN curl https://github.com/astrenoxcoop/supercell/archive/refs/tags/0.1.2.zip -L -o supercell.zip && unzip supercell.zip
RUN mv supercell-0.1.2 /app
WORKDIR /app
RUN curl https://github.com/bluesky-social/jetstream/raw/0ab10bd041fe1fdf682d3964b20d944905c4862d/pkg/models/zstd_dictionary -L -o ./jetstream_zstd_dictionary
RUN --mount=type=cache,target=/app/target/ \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
--mount=type=cache,target=/usr/local/cargo/registry/ \
<<EOF
set -e
cargo build --release --bin supercell --target-dir .
EOF
FROM debian:bookworm-slim
RUN set -x \
&& apt-get update \
&& apt-get install ca-certificates -y
RUN groupadd -g 1508 -r supercell && useradd -u 1509 -r -g supercell -d /var/lib/supercell -m supercell
ENV RUST_LOG=info
ENV RUST_BACKTRACE=full
ENV DATABASE_URL=sqlite:///var/lib/supercell/db/db.db?mode=rwc
ENV ZSTD_DICTIONARY=/var/lib/supercell/jetstream_zstd_dictionary
COPY ./config.yml /var/lib/supercell/config.yml
COPY --from=build /app/release/supercell /var/lib/supercell/
COPY --from=build /app/jetstream_zstd_dictionary /var/lib/supercell/
RUN mkdir -p /var/lib/supercell/db
RUN chown -R supercell:supercell /var/lib/supercell
WORKDIR /var/lib/supercell
USER supercell
ENTRYPOINT ["sh", "-c", "/var/lib/supercell/supercell"]