Skip to content

Commit 453f53c

Browse files
committed
perf: update Dockerfile
1 parent 608ec5e commit 453f53c

File tree

5 files changed

+16
-17
lines changed

5 files changed

+16
-17
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@
3131
**/values.dev.yaml
3232
LICENSE
3333
README.md
34+
/target/

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "backend"
33
description = "Backend API and services for StackClass"
4-
version = "0.20.0"
4+
version = "0.21.0"
55
edition = "2024"
66

77
default-run = "stackclass-server"

Dockerfile

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,7 @@
66

77
################################################################################
88
# Base image as the foundation for the other build stages in this file.
9-
FROM rust:slim AS chef
10-
11-
# Set the environment variables for the build.
12-
ENV CARGO_UNSTABLE_SPARSE_REGISTRY=true
13-
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
14-
15-
# We only pay the installation cost once,
16-
# it will be cached from the second build onwards
17-
RUN rustup default stable
18-
RUN rustup component add cargo rust-std rustc
19-
RUN cargo install cargo-chef
20-
9+
FROM lukemathwalker/cargo-chef:latest-rust-1-slim-bookworm AS chef
2110
WORKDIR /app
2211

2312
################################################################################
@@ -49,11 +38,20 @@ RUN cargo build --release --bin stackclass-server
4938
# the smallest image possible. This often means using a different and smaller
5039
# image than the one used for building the application, but for illustrative
5140
# purposes the "base" image is used here.
52-
FROM gcr.io/distroless/cc-debian12:nonroot AS runtime
41+
FROM debian:bookworm-slim AS runtime
42+
WORKDIR /app
43+
44+
RUN apt-get update && apt-get install -y --no-install-recommends \
45+
ca-certificates \
46+
&& apt-get clean \
47+
&& rm -rf /var/lib/apt/lists/*
48+
49+
RUN addgroup --system --gid 1001 axum
50+
RUN adduser --system --uid 1001 axum
51+
USER axum
5352

5453
# Copy the executable from the "building" stage.
5554
COPY --from=builder \
56-
--chown=nonroot:nonroot \
5755
/app/target/release/stackclass-server \
5856
/usr/local/bin/
5957

openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"license": {
77
"name": ""
88
},
9-
"version": "0.20.0"
9+
"version": "0.21.0"
1010
},
1111
"paths": {
1212
"/v1/courses": {

0 commit comments

Comments
 (0)