-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathDockerfile
More file actions
92 lines (61 loc) · 1.82 KB
/
Dockerfile
File metadata and controls
92 lines (61 loc) · 1.82 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
ARG CONTEXT=prod
FROM golang:1.26.0-alpine AS base
## Setup
ARG CONTEXT
WORKDIR /app
ENV APP_CONTEXT=${CONTEXT}
## Installs
RUN apk add git --no-cache
COPY go.mod go.sum ./
RUN go mod download
COPY cmd cmd
COPY pkg pkg
COPY proto proto
COPY Makefile Makefile
## External Information
EXPOSE 9008
## Healthcheck
HEALTHCHECK CMD ["/app/healthcheck"]
## Command
COPY ./dev/command.sh ./
RUN chmod +x command.sh
CMD ["./command.sh"]
# Development Image
FROM base AS dev
RUN ["go", "install", "github.com/githubnemo/CompileDaemon@latest"]
# Testing Image
FROM base AS tests
COPY dev/container-tests.sh ./dev/container-tests.sh
RUN apk add --no-cache \
build-base \
docker
RUN go get -u github.com/ory/dockertest/v3
RUN go install golang.org/x/lint/golint@latest
RUN chmod +x dev/container-tests.sh
## Command
STOPSIGNAL SIGKILL
# Production Image
FROM base AS builder
RUN CGO_ENABLED=0 go build ./cmd/openslides && \
CGO_ENABLED=0 go build ./cmd/server && \
CGO_ENABLED=0 go build ./cmd/healthcheck
FROM scratch AS client
WORKDIR /
ENV APP_CONTEXT=prod
COPY --from=builder /app/openslides .
ENTRYPOINT ["/openslides"]
FROM scratch AS prod
## Setup
ARG CONTEXT
ENV APP_CONTEXT=prod
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 /app/healthcheck /
COPY --from=builder /app/server /
EXPOSE 9008
ENTRYPOINT ["/server"]
HEALTHCHECK CMD ["/healthcheck"]