Skip to content

Commit b6c0b85

Browse files
ci&doc: fix the file path issues and write key comments
1 parent 69d2e3a commit b6c0b85

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

Dockerfile

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,48 @@
1-
# Import Background Image
1+
# Import Basic Image.
22
FROM rust:latest as build
33

4-
# Set up work path
4+
# Set up work path.
55
WORKDIR /home/app
66

7-
# Copy the Rust Project Files to Docker Image
7+
# Copy the Rust Project Files to Docker Image.
8+
# | Please pay attention to the COPY command, which is defined in Docker docs as follows:
9+
# | `Note: The directory itself is not copied, just its contents.`
10+
# | URL: https://docs.docker.com/engine/reference/builder/
811
COPY ./Cargo.toml /home/app
9-
COPY ./src /home/app
12+
COPY ./src /home/app/src
13+
COPY ./build.rs /home/app
1014

11-
# Set up Target Environment variable
15+
# Set up Target Environment variable.
1216
ENV OUT_DIR /home/app/target
1317

14-
# Cargo build Rust Project
18+
# Cargo build Rust Project.
1519
RUN cargo build --release
1620

17-
# Build a production environment Docker Image
21+
# Build a production environment Docker Image.
1822
FROM ubuntu:22.04
1923
LABEL author="Snowball_233"
2024

21-
# Switch to Root account
25+
# Switch to Root account.
2226
USER root
2327

24-
# Ubuntu Initialization
28+
# Ubuntu Initialization.
29+
# | Please replace the time zone according to your needs.
2530
RUN \
2631
ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
2732
echo 'Asia/Shanghai' > /etc/timezone && \
2833
apt-get update && \
2934
apt-get -y upgrade && \
3035
apt-get install -y htop vim
3136

32-
# Copy the binary files into Docker Image
33-
# Please replace the specific path according to your needs
37+
# Copy the binary files into Docker Image.
38+
# | Please replace the specific path according to your needs.
3439
COPY --from=build /home/app/target/release /home/BackendServer
3540

36-
# Clean up build cache
41+
# Clean up build cache.
3742
RUN \
3843
apt-get clean && \
3944
apt-get autoclean && \
4045
rm -rf /var/lib/apt/lists/*
4146

47+
# Run bash on start.
4248
CMD ["bash"]

0 commit comments

Comments
 (0)