From 13ca4eb6511b17e86f5ac0a2a2a04d136bd0312d Mon Sep 17 00:00:00 2001 From: Owen Ou Date: Sat, 3 Feb 2024 12:17:38 -0800 Subject: [PATCH] Revert "Shrink uptermd Docker image by 5 MB, 20% (#225)" This reverts commit bb763d6cdd9e5b1da00ffe794c71b3dfe0422828. --- .dockerignore | 3 --- Dockerfile.uptermd | 34 +++++++--------------------------- 2 files changed, 7 insertions(+), 30 deletions(-) delete mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 20871c2df..000000000 --- a/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -# Because changes to just the Dockerfile force a more or less total rebuild, -# which doesn't need to be the case. -Dockerfile.uptermd diff --git a/Dockerfile.uptermd b/Dockerfile.uptermd index e9ac3d2a1..043a6b29f 100644 --- a/Dockerfile.uptermd +++ b/Dockerfile.uptermd @@ -1,43 +1,23 @@ -FROM golang:1.21 as builder - -RUN adduser \ - --disabled-password \ - --gecos "" \ - --home "/nonexistent" \ - --shell "/sbin/nologin" \ - --no-create-home \ - --uid 65532 \ - noroot - -WORKDIR /build - -COPY go.mod . -COPY go.sum . - -RUN go mod download -RUN go mod verify +FROM golang:alpine as builder +WORKDIR $GOPATH/src/github.com/owenthereal/upterm COPY . . ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64 -RUN go build -o uptermd ./cmd/uptermd +RUN go install ./cmd/uptermd/... # Prepare for image -FROM scratch +FROM alpine:latest MAINTAINER Owen Ou LABEL org.opencontainers.image.source https://github.com/owenthereal/upterm +RUN adduser -D uptermd +USER uptermd WORKDIR /app ENV PATH="/app:${PATH}" -COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo -COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -COPY --from=builder /etc/passwd /etc/passwd -COPY --from=builder /etc/group /etc/group -COPY --from=builder /build/uptermd . - -USER noroot:noroot +COPY --from=builder /go/bin/* /app # sshd EXPOSE 2222