forked from OpenSlides/openslides-autoupdate-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (30 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
FROM golang:1.16.3-alpine as basis
LABEL maintainer="OpenSlides Team <info@openslides.com>"
WORKDIR /root/
RUN apk add git
COPY go.mod go.sum ./
RUN go mod download
COPY cmd cmd
COPY internal internal
COPY pkg pkg
# Build service in seperate stage.
FROM basis as builder
RUN CGO_ENABLED=0 go build ./cmd/autoupdate
# Test build.
FROM basis as testing
RUN apk add build-base
CMD go vet ./... && go test ./...
# Development build.
FROM basis as development
RUN ["go", "install", "github.com/githubnemo/CompileDaemon@latest"]
EXPOSE 9012
ENV MESSAGING redis
ENV AUTH ticket
CMD CompileDaemon -log-prefix=false -build="go build ./cmd/autoupdate" -command="./autoupdate"
# Productive build
FROM scratch
COPY --from=builder /root/autoupdate .
EXPOSE 9012
ENV MESSAGING redis
ENV AUTH ticket
ENTRYPOINT ["/autoupdate"]