-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.server
More file actions
37 lines (28 loc) · 874 Bytes
/
Dockerfile.server
File metadata and controls
37 lines (28 loc) · 874 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
# Use an official Rust runtime as a parent image
FROM rust:1.77-slim as builder
# Create a new empty shell project
#RUN USER=root cargo new --bin server
WORKDIR /server
#install build dependencies
RUN apt update
RUN apt-get -y install protobuf-compiler
# Copy our manifests
#RUN mkdir ./src/server
COPY . .
#COPY ./src/server/main.rs ./src/server
#COPY ./build.rs ./
#COPY ./Cargo.toml ./Cargo.lock ./
# This build step will cache your dependencies
RUN cargo build --release
RUN rm src/*.rs
# Now that the dependencies are built, copy your source code
COPY ./src ./src
# Build for release.
RUN rm ./target/release/deps/server*
RUN cargo build --bin server --release
# Final base
FROM debian:bookworm-slim
# Copy the build artifact from the build stage
COPY --from=builder /server/target/release/server .
# Set the startup command to run your binary
CMD ["./server"]