-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
64 lines (40 loc) · 1.43 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM golang:1.19-alpine as base
WORKDIR /root
RUN apk add git
COPY go.mod go.sum ./
RUN go mod download
COPY cmd cmd
COPY pkg pkg
COPY proto proto
COPY Makefile Makefile
# Build service in seperate stage.
FROM base as builder
RUN CGO_ENABLED=0 go build ./cmd/openslides
RUN CGO_ENABLED=0 go build ./cmd/server
RUN CGO_ENABLED=0 go build ./cmd/healthcheck
# Test build.
FROM base as testing
RUN apk add build-base
CMD make test
# Development build.
FROM base as development
RUN ["go", "install", "github.com/githubnemo/CompileDaemon@latest"]
EXPOSE 9008
CMD CompileDaemon -log-prefix=false -build="go build ./cmd/server" -command="./server"
# Productive build (client) tool.
FROM scratch as client
COPY --from=builder /root/openslides .
ENTRYPOINT ["/openslides"]
# Productive build server.
FROM scratch
LABEL org.opencontainers.image.title="OpenSlides Manage Service"
LABEL org.opencontainers.image.description="Manage service and tool for OpenSlides which \
provides some management commands to setup and control OpenSlides instances."
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.source="https://github.com/OpenSlides/openslides-manage-service"
LABEL org.opencontainers.image.documentation="https://github.com/OpenSlides/openslides-manage-service/blob/main/README.md"
COPY --from=builder /root/healthcheck .
COPY --from=builder /root/server .
EXPOSE 9008
ENTRYPOINT ["/server"]
HEALTHCHECK CMD ["/healthcheck"]