-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
45 lines (32 loc) · 1.28 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
FROM golang:1.23.3@sha256:73f06be4578c9987ce560087e2e2ea6485fb605e3910542cadd8fa09fc5f3e31 AS bff-builder
ARG BUILD_VERSION
ARG BUILD_COMMIT
ARG BUILD_DATE
WORKDIR /go/src/bff
COPY ./bff ./
RUN set -ex && \
go mod download && \
go build \
-ldflags=" \
-X 'github.com/harryzcy/mailbox-browser/bff/transport/rest/misc.version=${BUILD_VERSION}' \
-X 'github.com/harryzcy/mailbox-browser/bff/transport/rest/misc.commit=${BUILD_COMMIT}' \
-X 'github.com/harryzcy/mailbox-browser/bff/transport/rest/misc.buildDate=${BUILD_DATE}' \
-w -s" \
-o /bin/bff
FROM --platform=$BUILDPLATFORM node:23.3.0-alpine3.20@sha256:d03e75e7ba1385c2944f4cc374eb5abe0715234f87da5121dbd64f7262ad10df AS web-builder
ARG BUILD_VERSION
WORKDIR /app
COPY web ./
RUN npm ci && \
echo "export const browserVersion = \"${BUILD_VERSION}\"" > src/utils/info.ts && \
npm run build
FROM alpine:3.20.3@sha256:1e42bbe2508154c9126d48c2b8a75420c3544343bf86fd041fb7527e017a4b4a
RUN addgroup -S bff && adduser -S bff -G bff
USER bff
COPY --from=bff-builder --chown=bff:bff /bin/bff /bin/bff
COPY --from=web-builder --chown=bff:bff /app/dist /bin/dist
ENV MODE=prod
ENV STATIC_DIR=/bin/dist
ENV PORT=8070
HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD wget -qO- http://localhost:8070/ping || exit 1
CMD ["/bin/bff"]