Spaces:
Sleeping
Sleeping
Gusti Adli Anshari
commited on
Commit
•
418cd2c
1
Parent(s):
e854175
add commentary
Browse files- Dockerfile +7 -6
Dockerfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
# Base image
|
2 |
-
FROM rust:1.77.2-alpine3.18
|
3 |
-
#
|
4 |
WORKDIR /app
|
5 |
# Copy application code and dependencies
|
6 |
COPY . .
|
@@ -9,10 +9,11 @@ RUN apk add --no-cache musl-dev
|
|
9 |
# Build the application
|
10 |
RUN cargo install --path .
|
11 |
|
12 |
-
#
|
13 |
FROM scratch
|
14 |
-
|
15 |
WORKDIR /app/bin
|
|
|
16 |
COPY --from=builder /usr/local/cargo/bin/rust-rocket-counter-api /app/bin/app
|
17 |
-
|
18 |
CMD [ "./app" ]
|
|
|
1 |
+
# First Base image with alias:builder
|
2 |
+
FROM rust:1.77.2-alpine3.18 AS builder
|
3 |
+
# Set working directory
|
4 |
WORKDIR /app
|
5 |
# Copy application code and dependencies
|
6 |
COPY . .
|
|
|
9 |
# Build the application
|
10 |
RUN cargo install --path .
|
11 |
|
12 |
+
# Second Base Image
|
13 |
FROM scratch
|
14 |
+
# Set working directory
|
15 |
WORKDIR /app/bin
|
16 |
+
# Copy the application binary
|
17 |
COPY --from=builder /usr/local/cargo/bin/rust-rocket-counter-api /app/bin/app
|
18 |
+
# Run the binary
|
19 |
CMD [ "./app" ]
|