agent/Dockerfile.test
Rama master · réplica de lectura del repositorio original.
ARG DOCKERHUB_MIRROR=
ARG GOLANG_VERSION
FROM ${DOCKERHUB_MIRROR}golang:${GOLANG_VERSION}
RUN apk add --update ca-certificates util-linux setpriv bash openssh
RUN ln -sf /bin/bash /bin/sh
COPY ./tests/cmd/signal-reporter/main.go /tmp/signal-reporter/main.go
RUN --mount=type=cache,id=shellhub-go-build,target=/root/.cache/go-build,sharing=shared \
cd /tmp/signal-reporter && go build -o /usr/local/bin/signal-reporter main.go && rm -rf /tmp/signal-reporter
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub
COPY ./go.mod ./go.sum ./
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub/agent
COPY ./agent/go.mod ./agent/go.sum ./
RUN --mount=type=cache,id=shellhub-go-mod,target=/go/pkg/mod,sharing=shared \
go mod download
ARG SHELLHUB_VERSION=latest
ARG GO_TAGS=""
COPY ./pkg $GOPATH/src/github.com/shellhub-io/shellhub/pkg
COPY ./agent .
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub
RUN --mount=type=cache,id=shellhub-go-mod,target=/go/pkg/mod,sharing=shared \
go mod download
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub/agent
RUN --mount=type=cache,id=shellhub-go-mod,target=/go/pkg/mod,sharing=shared \
--mount=type=cache,id=shellhub-go-build,target=/root/.cache/go-build,sharing=shared \
go build -tags "${GO_TAGS}" -ldflags "-X main.AgentVersion=${SHELLHUB_VERSION}"
ARG USERNAME
ARG PASSWORD
RUN echo "${USERNAME}:${PASSWORD}" | chpasswd
ENTRYPOINT ["./agent"]