File size: 630 Bytes
418cd2c
 
 
a8af62d
28acf4a
a8af62d
28acf4a
a8af62d
28acf4a
a8af62d
 
418cd2c
116ecff
418cd2c
116ecff
418cd2c
116ecff
6463883
 
 
 
 
418cd2c
116ecff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# First Base image with alias:builder
FROM rust:1.77.2-alpine3.18 AS builder
# Set working directory
WORKDIR /app
# Copy application code and dependencies
COPY . .
# Install OS dependencies
RUN apk add --no-cache musl-dev
# Build the application
RUN cargo install --path .

# Second Base Image
FROM scratch
# Set working directory
WORKDIR /app/bin
# Copy the application binary
COPY --from=builder /usr/local/cargo/bin/rust-rocket-counter-api  /app/bin/app
# Copy config.yaml
COPY config.yaml /app/config.yaml
# Set environment variables
ENV CONFIG_PATH /app/config.yaml
ENV ROCKET_ADDRESS 0.0.0.0
# Run the binary
CMD [ "./app" ]