-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (32 loc) · 1.09 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
44
45
# Use the official Rust image as a parent image
FROM rust:slim-buster as builder
EXPOSE 8080
ENV PORT 8080
# Install build dependencies
RUN apt-get update && \
apt-get install -y pkg-config librust-openssl-dev libssl-dev build-essential g++ && \
rm -rf /var/lib/apt/lists/*
# Set the working directory in the container
WORKDIR /usr/src/felafax-proxy
# Copy the Cargo.toml and Cargo.lock files
COPY Cargo.toml Cargo.lock ./
# Copy the source code
COPY src ./src
# Build the application
RUN cargo build --release
# Start a new stage for a smaller final image
FROM rust:slim-buster
# Install runtime dependencies
RUN apt-get update && \
apt-get install -y ca-certificates libssl1.1 && \
rm -rf /var/lib/apt/lists/*
# Copy the binary from the builder stage
COPY --from=builder /usr/src/felafax-proxy/target/release/felafax-proxy /usr/local/bin/felafax-proxy
# Verify the binary exists and is executable
RUN ls -l /usr/local/bin/felafax-proxy && \
chmod +x /usr/local/bin/felafax-proxy
# Copy required config files
COPY .env .
COPY firebase.json .
# Set the startup command
CMD ["felafax-proxy"]