-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (23 loc) · 898 Bytes
/
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
FROM rustlang/rust:nightly-bookworm as builder
WORKDIR /app
COPY . /app
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/app/target \
cargo build --release && \
cp /app/target/release/highscore-rs /app
FROM debian:bookworm-slim
ARG USER_ID=1000
ARG GROUP_ID=1000
RUN apt update && apt upgrade --yes && apt install --yes libsqlite3-0 && rm -rf /var/lib/apt/lists/*
ENV DATABASE_URL=./highscore.sqlite
ENV ROCKET_ADDRESS=0.0.0.0
RUN groupadd --gid ${GROUP_ID} highscore && \
useradd --uid ${USER_ID} --gid highscore --shell /bin/bash --create-home highscore && \
mkdir /home/highscore/data && \
chown -R highscore:highscore /home/highscore/data
USER $USER_ID:$GROUP_ID
COPY --from=builder /app/highscore-rs /usr/local/bin
EXPOSE 8000:8000
WORKDIR /home/highscore/data
VOLUME ["/home/highscore/data"]
ENTRYPOINT ["highscore-rs"]