-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci&doc: fix the file path issues and write key comments
- Loading branch information
1 parent
69d2e3a
commit b6c0b85
Showing
1 changed file
with
18 additions
and
12 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,42 +1,48 @@ | ||
# Import Background Image | ||
# Import Basic Image. | ||
FROM rust:latest as build | ||
|
||
# Set up work path | ||
# Set up work path. | ||
WORKDIR /home/app | ||
|
||
# Copy the Rust Project Files to Docker Image | ||
# Copy the Rust Project Files to Docker Image. | ||
# | Please pay attention to the COPY command, which is defined in Docker docs as follows: | ||
# | `Note: The directory itself is not copied, just its contents.` | ||
# | URL: https://docs.docker.com/engine/reference/builder/ | ||
COPY ./Cargo.toml /home/app | ||
COPY ./src /home/app | ||
COPY ./src /home/app/src | ||
COPY ./build.rs /home/app | ||
|
||
# Set up Target Environment variable | ||
# Set up Target Environment variable. | ||
ENV OUT_DIR /home/app/target | ||
|
||
# Cargo build Rust Project | ||
# Cargo build Rust Project. | ||
RUN cargo build --release | ||
|
||
# Build a production environment Docker Image | ||
# Build a production environment Docker Image. | ||
FROM ubuntu:22.04 | ||
LABEL author="Snowball_233" | ||
|
||
# Switch to Root account | ||
# Switch to Root account. | ||
USER root | ||
|
||
# Ubuntu Initialization | ||
# Ubuntu Initialization. | ||
# | Please replace the time zone according to your needs. | ||
RUN \ | ||
ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ | ||
echo 'Asia/Shanghai' > /etc/timezone && \ | ||
apt-get update && \ | ||
apt-get -y upgrade && \ | ||
apt-get install -y htop vim | ||
|
||
# Copy the binary files into Docker Image | ||
# Please replace the specific path according to your needs | ||
# Copy the binary files into Docker Image. | ||
# | Please replace the specific path according to your needs. | ||
COPY --from=build /home/app/target/release /home/BackendServer | ||
|
||
# Clean up build cache | ||
# Clean up build cache. | ||
RUN \ | ||
apt-get clean && \ | ||
apt-get autoclean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Run bash on start. | ||
CMD ["bash"] |