-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (32 loc) · 1016 Bytes
/
Dockerfile
File metadata and controls
40 lines (32 loc) · 1016 Bytes
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
# STAGE ONE: COMPILE-TIME
# From base image and give it a tag
FROM rust:1.86.0 AS builder
# Set working directory, or it's set to default /root
WORKDIR /app
# install a compiler and a linker
RUN apt update && apt install lld clang -y && apt-get install -y libopenblas-dev
# Copy source code
COPY . .
# Setup environment variables
ENV SQLX_OFFLINE=true
# Use build tools to build target
RUN cargo build --release
# STAGE TWO: RUNTIME
FROM debian:latest AS runtime
WORKDIR /app
# Copy from souce to target
COPY --from=builder /app/target/release/flip_pine flip_pine
# INSTALL RUNTIME DEPENDENCIES
RUN apt-get update -y \
&& apt-get install -y openssl ca-certificates \
&& apt-get install -y libopenblas-dev \
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# Copy configurations
COPY configurations configurations
# Set runtime environment variables
ENV APP_ENV=production
# Set which command to run when start the container
ENTRYPOINT ["./flip_pine"]