Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Shrink uptermd Docker image by 5 MB, 20% (#225)" #228

Merged
merged 1 commit into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .dockerignore

This file was deleted.

34 changes: 7 additions & 27 deletions Dockerfile.uptermd
Original file line number Diff line number Diff line change
@@ -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
Expand Down