-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (26 loc) · 856 Bytes
/
Dockerfile
File metadata and controls
39 lines (26 loc) · 856 Bytes
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
FROM rust:1.78 as builder
ARG CARGO_NET_GIT_FETCH_WITH_CLI=true
ADD . ./
WORKDIR /backend
RUN cargo build --release
RUN rm -rf root/.ssh/
# Create a new, minimal image to run the app.
FROM debian:bookworm-slim
# Install dependencies.
RUN apt-get update \
&& apt-get install -y ca-certificates tzdata libpq5 \
&& rm -rf /var/lib/apt/lists/*
# Set environment variables.
ENV TZ=Etc/UTC \
APP_USER=WhatToDo
# Create a user and group used to run the app.
RUN groupadd $APP_USER \
&& useradd -g $APP_USER $APP_USER \
&& mkdir -p /app
# Copy the build artifact from the build stage.
COPY --from=builder /target/release/backend /app/backend
# Change ownership of the app directory to the app user.
RUN chown -R $APP_USER:$APP_USER /app/
RUN chmod u+x /app/backend
USER $APP_USER
ENTRYPOINT /app/backend --config /secrets/config.yaml