-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathDockerfile
44 lines (27 loc) · 941 Bytes
/
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
# build method: just run `docker build --rm --build-arg -t genshen/ssh-web-console .`
# build frontend code
FROM node:14.15.4-alpine3.12 AS frontend-builder
COPY web web-console/
RUN cd web-console \
&& yarn install \
&& yarn build
FROM golang:1.15.7-alpine3.13 AS builder
# set to 'on' if using go module
ARG STATIC_DIR=build
RUN apk add --no-cache git \
&& go get -u github.com/rakyll/statik
COPY ./ /go/src/github.com/genshen/ssh-web-console/
COPY --from=frontend-builder web-console/build /go/src/github.com/genshen/ssh-web-console/${STATIC_DIR}/
RUN cd ./src/github.com/genshen/ssh-web-console/ \
&& statik -src=${STATIC_DIR} \
&& go build \
&& go install
## copy binary
FROM alpine:3.13
ARG HOME="/home/web"
RUN adduser -D web -h ${HOME}
COPY --from=builder --chown=web /go/bin/ssh-web-console ${HOME}/ssh-web-console
WORKDIR ${HOME}
USER web
VOLUME ["${HOME}/conf"]
CMD ["./ssh-web-console"]