-
-
Notifications
You must be signed in to change notification settings - Fork 146
/
Copy pathDockerfile
67 lines (39 loc) · 1.36 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# base stage
FROM golang:1.22.6-alpine3.19 AS base
ARG GOPROXY
RUN apk add --update git ca-certificates build-base openssh-client
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub
COPY ./go.mod ./
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub/ssh
COPY ./ssh/go.mod ./ssh/go.sum ./
RUN go mod download
RUN apk add curl
# builder stage
FROM base AS builder
ARG GOPROXY
COPY ./pkg $GOPATH/src/github.com/shellhub-io/shellhub/pkg
COPY ./ssh .
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub
RUN go mod download
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub/ssh
RUN go build -tags internal_api
# development stage
FROM base AS development
ARG GOPROXY
ENV GOPROXY ${GOPROXY}
RUN apk add --update openssl
RUN go install github.com/air-verse/[email protected] && \
go install github.com/go-delve/delve/cmd/[email protected] && \
go install github.com/golangci/golangci-lint/cmd/[email protected] && \
go install github.com/vektra/mockery/v2/[email protected]
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub
RUN go mod download
COPY ./ssh/entrypoint-dev.sh /entrypoint.sh
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub/ssh
ENTRYPOINT ["/entrypoint.sh"]
# production stage
FROM alpine:3.21.3 AS production
RUN apk add curl
RUN apk add --update openssh-client
COPY --from=builder /go/src/github.com/shellhub-io/shellhub/ssh/ssh /ssh
ENTRYPOINT /ssh