faster docker build
This commit is contained in:
parent
1d20137c27
commit
b45652b305
4 changed files with 20 additions and 10 deletions
24
Dockerfile
24
Dockerfile
|
|
@ -2,21 +2,31 @@ FROM golang:1.18-stretch as builder
|
|||
|
||||
ARG VER=devel
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
|
||||
# thanks to https://github.com/montanaflynn/golang-docker-cache
|
||||
RUN mkdir -p /cache/crypto
|
||||
COPY crypto /cache/crypto
|
||||
COPY go.mod go.sum /cache/
|
||||
WORKDIR /cache
|
||||
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
|
||||
|
||||
RUN mkdir -p /out/plugins
|
||||
ADD . /src/
|
||||
WORKDIR /src
|
||||
RUN CGO_ENABLED=0 go build -o /out -ldflags "-X main.mainver=$VER" ./cmd/...
|
||||
RUN CGO_ENABLED=0 go build -o /out/plugins -ldflags "-X main.mainver=$VER" ./plugin/...
|
||||
RUN go build -o /out -ldflags "-X main.mainver=$VER" ./cmd/...
|
||||
RUN go build -o /out/plugins -ldflags "-X main.mainver=$VER" ./plugin/...
|
||||
|
||||
FROM busybox
|
||||
LABEL maintainer="Boshi Lian<farmer1992@gmail.com>"
|
||||
|
||||
COPY --from=ep76/openssh-static:latest /usr/bin/ssh-keygen /bin/ssh-keygen
|
||||
RUN mkdir /etc/ssh/
|
||||
RUN mkdir /sshpiperd
|
||||
|
||||
ADD entrypoint.sh /
|
||||
COPY --from=builder /out/ /
|
||||
COPY --from=ep76/openssh-static:latest /usr/bin/ssh-keygen /ssh-keygen
|
||||
ADD entrypoint.sh /sshpiperd
|
||||
COPY --from=builder /out/ /sshpiperd
|
||||
EXPOSE 2222
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["/sshpiperd", "/plugins/workingdir"]
|
||||
ENTRYPOINT ["/sshpiperd/entrypoint.sh"]
|
||||
CMD ["/sshpiperd/sshpiperd", "/sshpiperd/plugins/workingdir"]
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ sudo ./out/sshpiperd --log-level=trace ./out/simplemath -- ./out/fixed --target
|
|||
|
||||
Plugin list
|
||||
|
||||
* [workingdir](plugin/workingdir/) 🔀: ask for working directory before login, demo purpose
|
||||
* [workingdir](plugin/workingdir/) 🔀: `/home`-like directory to managed upstreams routing by sshpiped.
|
||||
* [azdevicecode](plugin/azdevicecode/) 🔒: ask user to enter [azure device code](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-device-code) before login
|
||||
* [fixed](plugin/fixed/) 🔀: fixed targetting the dummy sshd server
|
||||
* [simplemath](plugin/simplemath/) 🔒: ask for very simple math question before login, demo purpose
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ set -euo pipefail
|
|||
|
||||
|
||||
if [ ! -f /etc/ssh/ssh_host_rsa_key ];then
|
||||
/ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key
|
||||
ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Working Directory plugin for sshpiperd
|
||||
|
||||
`Working Dir` is a `/home`-like directory.
|
||||
SSHPiperd read files from `workingdir/[username]/` to know upstream's configuration.
|
||||
sshpiperd read files from `workingdir/[username]/` to know upstream's configuration.
|
||||
|
||||
e.g.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue