Improve image building performance

This commit is contained in:
JeremyStar™ 2024-04-20 17:02:31 +02:00
parent 3920dfa262
commit 91b0615809
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -5,11 +5,11 @@
#############################
FROM ghcr.io/archlinux/archlinux:latest AS builder
RUN pacman -Syu --noconfirm go base-devel git
RUN nice -20 pacman -Syu --noconfirm go base-devel git mold
RUN mkdir /builder /builder/bin
RUN git clone https://github.com/gorcon/rcon-cli /builder/rcon-cli
RUN git clone --depth=1 https://github.com/gorcon/rcon-cli /builder/rcon-cli
WORKDIR /builder/rcon-cli
RUN go build -ldflags "-s -w -X main.ServiceVersion=mcsd-builder" -o /builder/bin/rcon ./cmd/gorcon/main.go
RUN nice -20 go build -ldflags "-s -w -fuse-ld=mold -X main.ServiceVersion=mcsd-builder" -o /builder/bin/rcon ./cmd/gorcon/main.go
####################################
## MAIN ##
@ -25,7 +25,7 @@ LABEL org.opencontainers.image.documentation="https://git.staropensource.de/Jere
LABEL org.opencontainers.image.source="https://git.staropensource.de/JeremyStarTM/MCServerDocker"
LABEL org.opencontainers.image.licenses="GPL-3.0-only"
RUN pacman -Syu --noconfirm jre17-openjdk jre11-openjdk jre8-openjdk
RUN nice -20 pacman -Syu --noconfirm jre17-openjdk jre11-openjdk jre8-openjdk
RUN mkdir /app
ADD entrypoint.sh /app/entrypoint.sh
COPY --from=builder /builder/bin/rcon /usr/bin/rcon