fix: reduce footprint of docker builds (#515)
* fix: reduce footprint of docker builds - bump to alpine 3.22 - don't add build dependencies to final image - add runtime depencies, devtools to dev image * fix base image deps --------- Co-authored-by: Thomas Miceli <27960254+thomiceli@users.noreply.github.com>
This commit is contained in:
31
Dockerfile
31
Dockerfile
@@ -3,15 +3,8 @@ FROM alpine:3.22 AS base
|
||||
RUN apk update && \
|
||||
apk add --no-cache \
|
||||
make \
|
||||
shadow \
|
||||
openssl \
|
||||
openssh \
|
||||
curl \
|
||||
wget \
|
||||
git \
|
||||
gnupg \
|
||||
xz \
|
||||
gcc \
|
||||
git \
|
||||
musl-dev \
|
||||
libstdc++
|
||||
|
||||
@@ -29,6 +22,14 @@ COPY . .
|
||||
|
||||
|
||||
FROM base AS dev
|
||||
RUN apk add --no-cache \
|
||||
openssl \
|
||||
openssh-server \
|
||||
curl \
|
||||
wget \
|
||||
git \
|
||||
gnupg \
|
||||
xz
|
||||
|
||||
EXPOSE 6157 2222 16157
|
||||
|
||||
@@ -50,24 +51,16 @@ FROM alpine:3.22 as prod
|
||||
RUN apk update && \
|
||||
apk add --no-cache \
|
||||
shadow \
|
||||
openssl \
|
||||
openssh \
|
||||
openssh-server \
|
||||
curl \
|
||||
wget \
|
||||
git \
|
||||
gnupg \
|
||||
xz \
|
||||
gcc \
|
||||
musl-dev \
|
||||
libstdc++
|
||||
git
|
||||
|
||||
RUN addgroup -S opengist && \
|
||||
adduser -S -G opengist -s /bin/ash -g 'Opengist User' opengist
|
||||
|
||||
COPY --from=build --chown=opengist:opengist /opengist/config.yml config.yml
|
||||
|
||||
WORKDIR /app/opengist
|
||||
|
||||
COPY --from=build --chown=opengist:opengist /opengist/config.yml /config.yml
|
||||
COPY --from=build --chown=opengist:opengist /opengist/opengist .
|
||||
COPY --from=build --chown=opengist:opengist /opengist/docker ./docker
|
||||
|
||||
|
||||
Reference in New Issue
Block a user