mirror of
https://github.com/twofas/2fas-server.git
synced 2024-12-12 12:09:56 +01:00
31 lines
442 B
Docker
31 lines
442 B
Docker
|
FROM golang:1.15-alpine as build
|
||
|
|
||
|
ENV GO111MODULE=on \
|
||
|
CGO_ENABLED=0 \
|
||
|
GOOS=linux \
|
||
|
GOARCH=amd64
|
||
|
|
||
|
WORKDIR /go/src/2fas
|
||
|
|
||
|
COPY go.mod go.sum ./
|
||
|
|
||
|
RUN go mod download -x
|
||
|
|
||
|
COPY . .
|
||
|
|
||
|
RUN mkdir -p bin
|
||
|
|
||
|
RUN go build -trimpath -o bin/api ./cmd/websocket/main.go
|
||
|
|
||
|
FROM alpine:latest
|
||
|
|
||
|
RUN adduser 2fas -D
|
||
|
|
||
|
USER 2fas
|
||
|
|
||
|
WORKDIR /home/2fas/
|
||
|
|
||
|
COPY --from=build /go/src/2fas/bin/* /usr/local/bin/
|
||
|
COPY ./config/config.yml ./config.yml
|
||
|
|
||
|
CMD ["api"]
|