2023-07-23 16:39:02 +02:00
|
|
|
FROM golang:1.21-rc-alpine AS builder
|
2023-07-12 20:45:29 +02:00
|
|
|
|
|
|
|
ARG UID=1000
|
|
|
|
ARG GID=1000
|
|
|
|
|
2023-07-23 16:39:02 +02:00
|
|
|
RUN apk add upx shadow
|
|
|
|
|
|
|
|
RUN groupadd --gid ${GID} bobthebuilder && useradd -m --gid ${GID} --uid ${UID} bobthebuilder
|
2023-07-12 20:45:29 +02:00
|
|
|
|
|
|
|
RUN mkdir /build
|
|
|
|
RUN chown -Rv bobthebuilder:bobthebuilder /build
|
|
|
|
|
|
|
|
COPY . /workspace
|
|
|
|
RUN chown -Rv bobthebuilder:bobthebuilder /workspace
|
|
|
|
|
|
|
|
USER bobthebuilder
|
|
|
|
WORKDIR /workspace
|
|
|
|
|
2023-07-23 16:39:02 +02:00
|
|
|
RUN [ "go", "build", "-ldflags", "-s -w", "-o", "/build/docker_launcher", "." ]
|
|
|
|
|
|
|
|
RUN [ "upx", "/build/docker_launcher" ]
|
2023-07-14 15:28:50 +02:00
|
|
|
|
|
|
|
FROM alpine:latest
|
|
|
|
|
|
|
|
COPY --from=builder /build/docker_launcher /usr/local/bin/docker_launcher
|
|
|
|
|
|
|
|
ENTRYPOINT [ "/usr/local/bin/docker_launcher" ]
|