keep Docker images alpine based (#427)

keep Docker images alpine based

Signed-off-by: Zoey <zoey@z0ey.de>
This commit is contained in:
Zoey 2023-02-23 09:13:41 +01:00 committed by GitHub
parent 4a7bf38bde
commit 6c6ebb647a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 19 deletions

View file

@ -1,27 +1,25 @@
FROM --platform=${BUILDPLATFORM} golang:1.20 AS builder
FROM --platform=${BUILDPLATFORM} golang:1.20-alpine AS builder
ARG TARGETARCH
ARG TARGETOS
WORKDIR /workdir
COPY . .
RUN apt-get -y update && \
apt-get -y install protobuf-compiler && \
RUN apk add --no-cache bash git build-base protobuf && \
if [ -d "vendor" ]; then GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOPROXY=off make proxy -j$(nproc); else \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} make proxy -j$(nproc); fi
FROM debian:bullseye-slim
FROM alpine:3
ENV CONFIG=/config/proxy.conf
RUN adduser --system --no-create-home spreedbackend && \
apt-get update -y && \
apt-get install -y ca-certificates && \
rm -rf /var/apt/lists/*
RUN adduser -D spreedbackend && \
apk add --no-cache bash tzdata ca-certificates
COPY --from=builder /workdir/bin/proxy /usr/bin/nextcloud-spreed-signaling-proxy
COPY ./proxy.conf.in /config/proxy.conf.in
COPY ./docker/proxy/entrypoint.sh /
RUN chown spreedbackend /config
RUN /usr/bin/nextcloud-spreed-signaling-proxy -version
USER spreedbackend

View file

@ -1,28 +1,25 @@
FROM --platform=${BUILDPLATFORM} golang:1.20 AS builder
WORKDIR /workdir
FROM --platform=${BUILDPLATFORM} golang:1.20-alpine AS builder
ARG TARGETARCH
ARG TARGETOS
WORKDIR /workdir
COPY . .
RUN apt-get -y update && \
apt-get -y install protobuf-compiler && \
RUN apk add --no-cache bash git build-base protobuf && \
if [ -d "vendor" ]; then GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOPROXY=off make server -j$(nproc); else \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} make server -j$(nproc); fi
FROM debian:bullseye-slim
FROM alpine:3
ENV CONFIG=/config/server.conf
RUN adduser --system --no-create-home spreedbackend && \
apt-get update -y && \
apt-get install -y ca-certificates && \
rm -rf /var/apt/lists/*
RUN adduser -D spreedbackend && \
apk add --no-cache bash tzdata ca-certificates
COPY --from=builder /workdir/bin/signaling /usr/bin/nextcloud-spreed-signaling
COPY ./server.conf.in /config/server.conf.in
COPY ./docker/server/entrypoint.sh /
RUN chown spreedbackend /config
RUN /usr/bin/nextcloud-spreed-signaling -version
USER spreedbackend