forked from OpenSlides/openslides-autoupdate-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (30 loc) · 1.13 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
39
40
41
42
43
44
45
46
FROM golang:1.22.0-alpine as base
WORKDIR /root/
RUN apk add git
COPY go.mod go.sum ./
RUN go mod download
COPY main.go main.go
COPY internal internal
COPY pkg pkg
# Build service in seperate stage.
FROM base as builder
RUN go build
# Test build.
FROM base as testing
RUN apk add build-base
CMD go vet ./... && go test -test.short ./...
# Development build.
FROM base as development
RUN ["go", "install", "github.com/githubnemo/CompileDaemon@latest"]
EXPOSE 9012
CMD CompileDaemon -log-prefix=false -build="go build" -command="./openslides-autoupdate-service"
# Productive build
FROM scratch
LABEL org.opencontainers.image.title="OpenSlides Autoupdate Service"
LABEL org.opencontainers.image.description="The Autoupdate Service is a http endpoint where the clients can connect to get the current data and also updates."
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.source="https://github.com/OpenSlides/openslides-autoupdate-service"
COPY --from=builder /root/openslides-autoupdate-service .
EXPOSE 9012
ENTRYPOINT ["/openslides-autoupdate-service"]
HEALTHCHECK CMD ["/openslides-autoupdate-service", "health"]