-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathDockerfile
More file actions
88 lines (62 loc) · 2.05 KB
/
Dockerfile
File metadata and controls
88 lines (62 loc) · 2.05 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
ARG CONTEXT=prod
FROM golang:1.26.0-alpine AS base
## Setup
ARG CONTEXT
WORKDIR /app/openslides-search-service
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 meta meta
## External Information
EXPOSE 9050
# Development Image
FROM base AS dev
## Installs
RUN ["go", "install", "github.com/githubnemo/CompileDaemon@latest"]
RUN apk add make bash-completion postgresql-client
COPY entrypoint.sh ./
COPY meta/search.yml ./
COPY dev/mock_data.sql ./dev/mock_data.sql
COPY dev/create-models.sh ./dev/create-models.sh
## Entrypoint
ENTRYPOINT ["./entrypoint.sh"]
HEALTHCHECK CMD wget --spider -q http://localhost:9050/system/search/health || exit 1
## Command
CMD CompileDaemon -log-prefix=false -build="go build -o openslides-search-service ./cmd/searchd/main.go" -command="./openslides-search-service"
# Testing Image
FROM dev AS tests
COPY dev/container-tests.sh ./dev/container-tests.sh
RUN apk add --no-cache \
build-base \
docker && \
go get -u github.com/ory/dockertest/v3 && \
go install golang.org/x/lint/golint@latest && \
chmod +x dev/container-tests.sh
## Command
STOPSIGNAL SIGKILL
CMD ["sleep", "inf"]
# Production Image
FROM base AS builder
RUN go build -o openslides-search-service ./cmd/searchd/main.go
FROM alpine:3 AS prod
## Setup
ARG CONTEXT
ENV APP_CONTEXT=prod
COPY entrypoint.sh /
COPY meta/search.yml /
COPY meta meta
COPY --from=builder /app/openslides-search-service/openslides-search-service /
## External Information
LABEL org.opencontainers.image.title="OpenSlides Search Service"
LABEL org.opencontainers.image.description="The Search Service is a http endpoint where the clients can search for data within Openslides."
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.source="https://github.com/OpenSlides/openslides-search-service"
EXPOSE 9050
## Command
ENTRYPOINT ["./entrypoint.sh"]
CMD exec ./openslides-search-service
HEALTHCHECK CMD wget --spider -q http://localhost:9050/system/search/health || exit 1