-
Notifications
You must be signed in to change notification settings - Fork 44
/
Dockerfile
35 lines (26 loc) · 943 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
FROM node:20 as node
WORKDIR /app
COPY web web
## remove generated files in case the developer build with npm before
RUN rm -rf web/assets/ts-dist &&\
rm -rf web/assets/css-dist
WORKDIR /app/web
RUN npm i --no-dev
FROM golang:1.21-alpine3.18 as build-env
RUN mkdir /gostuff
WORKDIR /gostuff
COPY go.mod go.sum ./
# Get dependencies - will also be cached if we won't change mod/sum
RUN go mod download
WORKDIR /go/src/app
COPY . .
COPY --from=node /app/web/assets ./web/assets
COPY --from=node /app/web/node_modules ./web/node_modules
# bundle version into binary if specified in build-args, dev otherwise.
ARG version=dev
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-w -extldflags '-static' -X main.VersionTag=${version}" -o /go/bin/tumlive cmd/tumlive/tumlive.go
FROM alpine:3.18
RUN apk add --no-cache tzdata openssl
WORKDIR /app
COPY --from=build-env /go/bin/tumlive .
CMD ["sh", "-c", "sleep 3 && ./tumlive"]