-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile
52 lines (31 loc) · 827 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
45
46
47
48
49
50
51
52
FROM node:lts-alpine as js-builder
WORKDIR /app/web-ui
COPY web-ui/package*.json ./
RUN npm ci
COPY . /app
RUN npm run build
#####
FROM golang:1.23-alpine as go-builder
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=js-builder /app/web-ui/dist pkg/assets/web-ui
RUN --mount=type=cache,target=/root/.cache/go-build \
go generate && \
CGO_ENABLED=0 \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -o sharepass -ldflags "-w -s" *.go
#####
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:latest
RUN apk --update add ca-certificates && \
update-ca-certificates && \
rm -rf /var/cache/apk/*
WORKDIR /app
VOLUME [ "/app/data" ]
EXPOSE 5000
COPY --from=go-builder /app/sharepass ./
CMD ["/app/sharepass"]