-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
38 lines (32 loc) · 1.08 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
############################
# Build api
############################
FROM golang:1.15.15-alpine3.14 AS apibuilder
RUN apk update && apk add --no-cache git dep
COPY api $GOPATH/src/github.com/alexbrazier/go-url/api
WORKDIR $GOPATH/src/github.com/alexbrazier/go-url/api
# install the dependencies without checking for go code
RUN dep ensure -vendor-only
# Build my app
RUN go build -o /go/bin/server
############################
# Build frontend
############################
FROM node:16.16.0-alpine AS frontendbuilder
COPY frontend /app
WORKDIR /app
RUN yarn --frozen-lockfile --network-timeout 600000 && \
yarn build
############################
# Build actual image
############################
FROM alpine:3.16
# Need to get updated certificates to connect to Slack API
RUN apk update && apk add bash dumb-init ca-certificates && rm -rf /var/cache/apk/*
# Copy our static executable.
COPY --from=apibuilder /go/bin/server /go/bin/server
COPY --from=frontendbuilder /app/build /go/bin/public
WORKDIR /go/bin
COPY entrypoint.sh .
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/go/bin/entrypoint.sh"]