-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
22 lines (16 loc) · 814 Bytes
/
Dockerfile
File metadata and controls
22 lines (16 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM rust:1.93.1-alpine3.23 AS builder
RUN apk add --no-cache build-base alpine-sdk musl-dev openssl linux-headers
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
RUN --mount=type=bind,source=.git,target=/app/.git,ro \
sh -c "mkdir -p src && echo 'fn main() {}' > src/main.rs && cargo fetch --locked && rm -rf src"
COPY . /app
RUN --mount=type=bind,source=.git,target=/app/.git,ro cargo build --release
RUN mkdir -p /app/certs && \
openssl ecparam -name prime256v1 -genkey -noout -out /app/certs/key.pem && \
openssl req -new -x509 -key /app/certs/key.pem -out /app/certs/cert.pem -days 1825 -subj "/CN=localhost"
FROM alpine:3.23
RUN apk add --no-cache libstdc++
COPY --from=builder /app/target/release/gateway /usr/local/bin/
COPY --from=builder /app/certs /etc/certs
CMD ["/usr/local/bin/gateway"]