-
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.4@sha256:7ea4c9dcb2b97ff8ee80a67db3d44f98c8ffa0d191399197007d8459c1453041 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.6.0-alpine3.20@sha256:6977602e02b3fee978f5927afbcc2f8990966c18838cf6bcd067373e2462ad65 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.21.2@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099
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"]