-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (30 loc) · 1.01 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
# Use the official AlmaLinux base image
FROM almalinux:latest AS builder
# Set the working directory inside the container
WORKDIR /usr/src/servopanel
# Install sudo
RUN dnf install -y sudo
# Install necessary dependencies (e.g., build tools, Rust)
RUN dnf install -y gcc make curl --allowerasing
# Install Rust toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Add Rust to PATH
ENV PATH="/root/.cargo/bin:${PATH}"
# Add your Rust project files to the container
COPY . .
# Build your Rust application
RUN cargo build --release
# Debug stage
FROM builder AS debug
RUN cargo build
# Test stage
FROM builder AS test
RUN cargo test
# Final stage
FROM almalinux:latest
# Set the working directory inside the container
WORKDIR /usr/src/servopanel
# Copy built artifacts from the builder stage
COPY --from=builder /usr/src/servopanel/target/release/servopanel ./target/release/servopanel
# Set the entry point (modify this based on your project's structure)
CMD ["./target/release/servopanel"]