- Build SQLx queries beforehand so that we don't have to do PostgreSQL init right away at service start up - Created `Dockerfile.production` - Updated docs - Seperate configuration files for local and development environments
21 lines
699 B
Docker
21 lines
699 B
Docker
# We use the latest Rust stable release as base image
|
|
FROM rust:1.78.0
|
|
# Let's switch our working directory to `app` (equivalent to `cd app`)
|
|
# The `app` folder will be created for us by Docker in case it does not
|
|
# exist already.
|
|
WORKDIR /app
|
|
# Install the required system dependencies for our linking configuration
|
|
RUN apt update && apt install lld clang -y
|
|
|
|
# Copy all files from our working environment to our Docker image
|
|
COPY . .
|
|
# Let's build our binary!
|
|
# We'll use the release profile to make it faaaast
|
|
ENV SQLX_OFFLINE true
|
|
RUN cargo build --release
|
|
|
|
ENV APP_ENVIRONMENT production
|
|
|
|
# When `docker run` is executed, launch the binary!
|
|
ENTRYPOINT ["./target/release/email_newsletter_api"]
|