-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
32 lines (22 loc) · 812 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
# Use the official Rust image as the base
FROM rust:latest
# Set the working directory inside the container
WORKDIR /usr/src/put-lang
# Copy the Cargo.toml and Cargo.lock files
COPY Cargo.toml Cargo.lock ./
# Create a dummy main.rs to build dependencies
RUN mkdir src && echo "fn main() {}" > src/main.rs
# Build dependencies - this layer will be cached unless Cargo.toml or Cargo.lock change
RUN cargo build --release
# Remove the dummy src folder and target directory
RUN rm -rf src target
# Copy the actual source code
COPY src/ ./src/
# Copy the tests
COPY tests/ ./tests/
# Copy the project.zom file
COPY project.zom ./
# Build the actual application
RUN cargo build --release
# Set the default command to run the compiled binary
CMD ["./target/release/put-lang"]