Update dockerfile

This commit is contained in:
Jai A 2024-10-16 16:07:24 -07:00
parent 39f0408929
commit cc22a92daf
No known key found for this signature in database
GPG Key ID: 9A9F9B7250E9883C

View File

@ -1,29 +1,15 @@
FROM rust:1.75.0 as build FROM rust:1.79.0 as build
ENV PKG_CONFIG_ALLOW_CROSS=1 ENV PKG_CONFIG_ALLOW_CROSS=1
WORKDIR /usr/src/labrinth WORKDIR /usr/src/labrinth
# Download and compile deps
COPY Cargo.toml .
COPY Cargo.lock .
COPY docker_utils/dummy.rs .
# Change temporarely the path of the code
RUN sed -i 's|src/main.rs|dummy.rs|' Cargo.toml
# Build only deps
RUN cargo build --release --features jemalloc
# Now return the file back to normal
RUN sed -i 's|dummy.rs|src/main.rs|' Cargo.toml
# Copy everything
COPY . . COPY . .
# Build our code RUN cargo build --release
ARG SQLX_OFFLINE=true
RUN cargo build --release --features jemalloc
# Final Stage
FROM ubuntu:latest FROM debian:bookworm-slim
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \ && apt-get install -y --no-install-recommends ca-certificates openssl \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*