-
Notifications
You must be signed in to change notification settings - Fork 2
/
DockerfileWithotel
108 lines (83 loc) · 2.87 KB
/
DockerfileWithotel
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
FROM golang:1.21-alpine AS builder
RUN apk update && apk add --no-cache git
RUN apk add build-base
WORKDIR /myapp
COPY ./app ./app
COPY ./aws ./aws
COPY ./crypto ./crypto
COPY ./db ./db
COPY ./errors ./errors
COPY ./kafka ./kafka
COPY ./log ./log
COPY ./utils ./utils
COPY ./testutils ./testutils
COPY ./go.mod ./go.mod
COPY ./instrumentation ./instrumentation
RUN go mod tidy
FROM alpine:latest AS runner
RUN apk --no-cache add tzdata bash
WORKDIR /service
FROM builder AS httpbuilder
WORKDIR /myapp/app/server/httpserver/test/http/otel
RUN go build -tags musl -o /app -ldflags '-linkmode external -w -extldflags "-static"'
FROM builder AS h2cbuilder
WORKDIR /myapp/app/server/httpserver/test/h2c/otel
RUN go build -tags musl -o /app -ldflags '-linkmode external -w -extldflags "-static"'
FROM builder AS http2builder
WORKDIR /myapp/app/server/httpserver/test/http2/otel
RUN go build -tags musl -o /app -ldflags '-linkmode external -w -extldflags "-static"'
FROM builder AS kafkabuilder
WORKDIR /myapp/app/server/kafkaconsumer/test/consumer/otel
RUN go build -tags musl -o /app -ldflags '-linkmode external -w -extldflags "-static"'
FROM runner AS http
COPY --from=httpbuilder /app /service/app
COPY ./docs /service/docs
EXPOSE 8080
ENTRYPOINT ["/service/app"]
FROM runner AS h2c
COPY --from=h2cbuilder /app /service/app
COPY ./docs /service/docs
EXPOSE 8080
ENTRYPOINT ["/service/app"]
FROM runner AS http2
COPY --from=http2builder /app /service/app
COPY ./docs /service/docs
COPY ./app/server/httpserver/test/http2/server.crt /service/server.crt
COPY ./app/server/httpserver/test/http2/server.key /service/server.key
EXPOSE 8080
ENTRYPOINT ["/service/app"]
FROM runner AS kafka
COPY --from=kafkabuilder /app /service/app
ENTRYPOINT ["/service/app"]
FROM golang:1.21-bullseye AS bullseyebuilder
RUN apt-get update && apt-get install tzdata
WORKDIR /myapp
COPY ./pkg/mongo/debian/bullseye ./pkg
COPY ./app ./app
COPY ./aws ./aws
COPY ./crypto ./crypto
COPY ./db ./db
COPY ./errors ./errors
COPY ./kafka ./kafka
COPY ./log ./log
COPY ./utils ./utils
COPY ./testutils ./testutils
COPY ./go.mod ./go.mod
COPY ./instrumentation ./instrumentation
RUN apt-get install ./pkg/libmongocrypt-dev_1.8.4-0_amd64.deb ./pkg/libmongocrypt0_1.8.4-0_amd64.deb
RUN go mod tidy
FROM debian:bullseye-slim AS csflerunner
RUN apt-get install tzdata
WORKDIR /service
COPY ./pkg/mongo/debian/bullseye ./pkg
COPY ./db/mongo/csfle/sample/piischeme.json ./piischeme.json
RUN apt-get install /service/pkg/libmongocrypt-dev_1.8.4-0_amd64.deb /service/pkg/libmongocrypt0_1.8.4-0_amd64.deb
ENV CSFLE_CRYPT_SHARED_LIB_PATH=/service/pkg/mongo_crypt_shared_v1-7.0.5/lib/mongo_crypt_v1.so
ENV SCHEME_LOCATION=/service/piischeme.json
FROM bullseyebuilder AS csfle
WORKDIR /myapp/db/mongo/csfle/test/http/otel
RUN go build -tags cse -o /app
FROM csflerunner AS httpcsfle
COPY --from=csfle /app /service/app
EXPOSE 8080
ENTRYPOINT ["/service/app"]