-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (26 loc) · 1 KB
/
Copy pathDockerfile
File metadata and controls
38 lines (26 loc) · 1 KB
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
FROM rust:1.89.0-slim-bookworm as builder
RUN apt-get update && apt-get install -y \
pkg-config \
libpq-dev \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
COPY . .
# build app and diesel CLI
RUN cargo install diesel_cli --no-default-features --features postgres
RUN cargo build --release
# runtime
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates libpq5 && rm -rf /var/lib/apt/lists/*
WORKDIR /opt/dns-service
# copy app and diesel
COPY --from=builder /usr/src/app/target/release/dns_scriptylabs_com .
COPY --from=builder /usr/local/cargo/bin/diesel /usr/local/bin/
COPY --from=builder /usr/src/app/migrations /opt/dns-service/migrations
COPY --from=builder /usr/src/app/.env /opt/dns-service/.env
COPY start.sh /opt/dns-service/start.sh
RUN chmod +x /opt/dns-service/start.sh ./dns_scriptylabs_com
RUN chmod +x /opt/dns-service/migrations/
RUN chmod +x /opt/dns-service/dns_scriptylabs_com
EXPOSE 5550
CMD ["/opt/dns-service/start.sh"]