-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
290c36c
commit 8d874ae
Showing
3 changed files
with
63 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Use the official Rust image as the base image | ||
FROM rust:latest AS builder | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy the Cargo.toml and Cargo.lock files to the container | ||
COPY Cargo.toml Cargo.lock ./ | ||
|
||
# Build the dependencies separately to take advantage of Docker layer caching | ||
RUN mkdir -p src && touch src/lib.rs && cargo build --release && rm -rf src | ||
|
||
# Copy the source code to the container | ||
COPY build.rs . | ||
COPY src ./src | ||
|
||
# Build the project | ||
RUN cargo build --release | ||
|
||
# Create a new container for running the build executable | ||
FROM debian:stable-slim | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy the build executable from the builder container | ||
COPY --from=builder /app/target/release/rsjudge . | ||
|
||
COPY templates/* config/ | ||
|
||
# Set the entry point for the container | ||
CMD ["./rsjudge", "-c", "config"] |