Reduce periphery image size (#82)

* Reduce periphery image size

* rename new alpine Dockerfile as slim.Dockerfile

* bump slim dockerfile rust version

---------

Co-authored-by: mbecker20 <becker.maxh@gmail.com>
This commit is contained in:
Jérémy
2024-09-21 23:57:51 +02:00
committed by GitHub
parent fc41258d6c
commit 3236302d05
2 changed files with 30 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
# Build Periphery
FROM rust:1.80.1-bookworm AS builder
FROM rust:1.81.0-bookworm AS builder
WORKDIR /builder
COPY . .
RUN cargo build -p komodo_periphery --release

View File

@@ -0,0 +1,29 @@
# Build Periphery
FROM rust:1.81.0-alpine AS builder
WORKDIR /builder
COPY . .
RUN apk update && apk --no-cache add musl-dev openssl-dev openssl-libs-static
RUN cargo build -p komodo_periphery --release
# Final Image
FROM alpine:3.20
# Install Deps
RUN apk update && apk add docker-cli docker-cli-compose openssl git git-lfs bash
# Setup an application directory
WORKDIR /app
# Copy
COPY --from=builder /builder/target/release/periphery /app
# Hint at the port
EXPOSE 8120
# Label for Ghcr
LABEL org.opencontainers.image.source=https://github.com/mbecker20/komodo
LABEL org.opencontainers.image.description="Komodo Periphery"
LABEL org.opencontainers.image.licenses=GPL-3.0
# Using ENTRYPOINT allows cli args to be passed, eg using "command" in docker compose.
ENTRYPOINT [ "/app/periphery" ]