+57
-1
Diff
round #2
+46
Dockerfile
+46
Dockerfile
···
1
+
# Use the official Rust image
2
+
FROM rust:1.82-slim as builder
3
+
4
+
# Install build dependencies
5
+
RUN apt-get update && apt-get install -y \
6
+
pkg-config \
7
+
libssl-dev \
8
+
&& rm -rf /var/lib/apt/lists/*
9
+
10
+
# Set working directory
11
+
WORKDIR /app
12
+
13
+
# Copy manifest files
14
+
COPY Cargo.toml Cargo.lock ./
15
+
16
+
# Copy source code
17
+
COPY src ./src
18
+
19
+
# Build the application
20
+
RUN cargo build --release
21
+
22
+
# Runtime stage
23
+
FROM debian:bookworm-slim
24
+
25
+
# Install runtime dependencies
26
+
RUN apt-get update && apt-get install -y \
27
+
ca-certificates \
28
+
&& rm -rf /var/lib/apt/lists/*
29
+
30
+
# Create app user
31
+
RUN useradd -r -s /bin/false appuser
32
+
33
+
# Set working directory
34
+
WORKDIR /app
35
+
36
+
# Copy the binary from builder stage
37
+
COPY --from=builder /app/target/release/discordhose /app/discordhose
38
+
39
+
# Change ownership to app user
40
+
RUN chown -R appuser:appuser /app
41
+
42
+
# Switch to app user
43
+
USER appuser
44
+
45
+
# Run the application
46
+
CMD ["./discordhose"]
+10
docker-compose.yml
+10
docker-compose.yml
History
3 rounds
0 comments
expand 0 comments
closed without merging