generated from greenbone/go-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
41 lines (30 loc) · 836 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
FROM golang:1.23.3-alpine AS builder
RUN apk add --no-cache make
# swagger docs generation will fail if cgo is used
ENV CGO_ENABLED=0
WORKDIR /src/
# preinstall dependencies for better build caching
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY Makefile .
# preinstall code generation tools for better build caching
RUN make install-code-generation-tools
# copy api related source files and generate api docs
COPY pkg/web pkg/web
COPY pkg/models pkg/models
RUN make api-docs
# copy rest of the source files
COPY cmd cmd
COPY pkg pkg
# (re)generate mocks
COPY .mockery.yaml .mockery.yaml
RUN make generate-code
# test and build
RUN make test
RUN make build
FROM busybox
# service files
COPY --from=builder /src/api /api
COPY --from=builder /src/bin/notification-service /bin/
ENTRYPOINT ["./bin/notification-service"]