-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.Dockerfile
More file actions
31 lines (22 loc) · 857 Bytes
/
server.Dockerfile
File metadata and controls
31 lines (22 loc) · 857 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
# Build Stage
FROM rust:1.75.0-alpine3.19 AS builder
# Install musl-tools to make many crates compile successfully
RUN apk add --no-cache musl-dev
# Install buf and protoc
RUN apk add --no-cache curl unzip && \
curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v25.0/protoc-25.0-linux-x86_64.zip -o protoc.zip && \
unzip protoc.zip -d /usr/local bin/protoc && \
unzip protoc.zip -d /usr/local 'include/*' && \
rm protoc.zip && \
curl -sSL https://github.com/bufbuild/buf/releases/download/v1.28.0/buf-Linux-x86_64 -o /usr/local/bin/buf && \
chmod +x /usr/local/bin/buf
COPY . .
# Build the application
WORKDIR server
RUN cargo build --release
# Deploy Stage
FROM alpine:3.19
WORKDIR /app
# Copy the binary from the builder stage
COPY --from=builder /server/target/release/server /app/
CMD ["./server"]