refactor: Revise Dockerfile - Remove entrypoint.sh (#598)

* chore: Formatting

* chore: Formatting (fix indent)

* refactor: Remove entrypoint

* chore: Remove `entrypoint.sh` from `.goreleaser.yaml`

* tests: Replace `entrypoint.sh` script usage in `e2eentry.sh`

* Set default plugin argument from environment variable in main function and update Dockerfile to remove CMD instruction

* Add user and group setup for testing in Dockerfile and update e2e entry script

* Update cmd/sshpiperd/main.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update cmd/sshpiperd/main.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Remove test user and group creation from Dockerfile and move it to e2e entry script; update plugin argument handling in main function

* Update Dockerfile

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Skip empty plugin directory entries in main function

---------

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Boshi Lian 2025-05-25 02:11:04 -07:00 committed by GitHub
parent 2edfa6b4c3
commit ca311e15cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 51 additions and 27 deletions

View file

@ -1,12 +1,10 @@
FROM docker.io/golang:1.24-bookworm as builder
FROM docker.io/golang:1.24-bookworm AS builder
ARG VER=devel
ARG BUILDTAGS
ARG EXTERNAL=0
ENV CGO_ENABLED=0
WORKDIR /src
RUN \
--mount=target=/src,type=bind,source=. \
--mount=type=cache,target=/root/.cache/go-build \
@ -22,13 +20,14 @@ RUN \
go build -o /sshpiperd/plugins -tags "${BUILDTAGS}" ./plugin/... ./e2e/testplugin/...
fi
HEREDOC
ADD entrypoint.sh /sshpiperd
FROM builder as testrunner
FROM builder AS testrunner
COPY --from=farmer1992/openssh-static:V_9_8_P1 /usr/bin/ssh /usr/bin/ssh-9.8p1
COPY --from=farmer1992/openssh-static:V_8_0_P1 /usr/bin/ssh /usr/bin/ssh-8.0p1
FROM docker.io/busybox
FROM docker.io/busybox AS sshpiperd
ARG USERID=1000
ARG GROUPID=1000
RUN <<HEREDOC
@ -43,7 +42,8 @@ HEREDOC
COPY --from=builder --chown=${USERID} /sshpiperd/ /sshpiperd
# Runtime setup:
ENV SSHPIPERD_SERVER_KEY_GENERATE_MODE=notexist PLUGIN=workingdir
ENTRYPOINT ["/sshpiperd/sshpiperd"]
USER ${USERID}:${GROUPID}
EXPOSE 2222
ENTRYPOINT ["/sshpiperd/entrypoint.sh"]