Improvements to Dockerfile
All checks were successful
Build and push container image / build (push) Successful in 13m27s

This commit is contained in:
toast 2024-08-03 13:04:19 +10:00
parent ec1aa9db0a
commit eb5944754e
4 changed files with 13 additions and 15 deletions

2
Cargo.lock generated
View File

@ -1020,7 +1020,7 @@ dependencies = [
[[package]]
name = "kon"
version = "0.3.9"
version = "0.3.10"
dependencies = [
"bb8",
"bb8-postgres",

View File

@ -1,6 +1,6 @@
[package]
name = "kon"
version = "0.3.9"
version = "0.3.10"
edition = "2021"
[dependencies]

View File

@ -1,25 +1,22 @@
FROM rust:1.80-alpine3.20@sha256:596c7fa13f7458097b8c88ad83f33420da0341e2f5b544e34d9aa18a22fe11d0 AS chef
FROM rust:1.80-alpine3.20 AS chef
ENV RUSTFLAGS="-C target-feature=-crt-static"
RUN apk add --no-cache openssl-dev musl-dev
RUN cargo install cargo-chef
WORKDIR /usr/src/kon
WORKDIR /builder
FROM chef AS planner
COPY . .
RUN cargo chef prepare
FROM chef AS dependencies
COPY --from=planner /usr/src/kon/recipe.json recipe.json
RUN cargo chef cook --release
FROM chef AS builder
COPY --from=planner /usr/src/kon/.cargo /usr/src/kon/.cargo
COPY --from=dependencies /usr/src/kon/target /usr/src/kon/target
COPY --from=planner /builder/recipe.json recipe.json
RUN cargo chef cook --release
COPY . .
RUN cargo build -rF production
RUN cargo build --offline -rF production
FROM alpine:3.20@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5
FROM alpine:edge
LABEL org.opencontainers.image.source="https://git.toast-server.net/toast/Kon"
RUN apk add --no-cache libgcc fluidsynth
WORKDIR /kon
COPY --from=builder /usr/src/kon/target/release/kon .
COPY --from=builder /builder/target/release/kon .
CMD [ "./kon" ]

View File

@ -8,20 +8,21 @@ services:
- cache
cache:
container_name: kon-redis
image: redis/redis-stack-server:7.4.0-rc2@sha256:18550d52dc39be0bbdcb6a3df57eb34e774ae776b32dfd5f392859d06d470150
image: redis/redis-stack-server:7.4.0-v0
restart: unless-stopped
ports:
- 37935:6379/tcp
# db:
# container_name: kon-database
# image: postgres:16.2-alpine3.19@sha256:951bfda460300925caa3949eaa092ba022e9aec191bbea9056a39e2382260b27
# image: postgres:16.3-alpine3.20
# restart: unless-stopped
# ports:
# - 37930:5432/tcp
# volumes:
# - /var/lib/docker/volumes/kon-database:/var/lib/postgresql/data:rw
# environment:
# TZ: Australia/Sydney
# POSTGRES_USER: ${POSTGRES_USER}
# POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
# POSTGRES_DB: ${POSTGRES_DB}