-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
32 lines (20 loc) · 791 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
FROM rust:1.83 AS builder
WORKDIR /volume
RUN apt-get update && \
apt-get install -y --no-install-recommends musl-tools && \
rustup target add x86_64-unknown-linux-musl && \
cargo init --bin
COPY Cargo.lock Cargo.toml ./
RUN cargo build --release --target x86_64-unknown-linux-musl
COPY migrations/ migrations/
COPY queries/ queries/
COPY src/ src/
RUN touch src/main.rs && cargo build --release --target x86_64-unknown-linux-musl
FROM alpine:3 AS newuser
RUN echo "togglebot:x:1000:" > /tmp/group && \
echo "togglebot:x:1000:1000::/dev/null:/sbin/nologin" > /tmp/passwd
FROM scratch
COPY --from=builder /volume/target/x86_64-unknown-linux-musl/release/togglebot /bin/
COPY --from=newuser /tmp/group /tmp/passwd /etc/
USER togglebot
ENTRYPOINT ["/bin/togglebot"]