-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (32 loc) · 1.3 KB
/
Dockerfile
File metadata and controls
45 lines (32 loc) · 1.3 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
FROM golang:1.26.4@sha256:11fd8f7f63db3b6fb198797042ba4c40a4a34dc83325d3328ca3bc4bb7726786 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/miscendpoint.version=${BUILD_VERSION}' \
-X 'github.com/harryzcy/mailbox-browser/bff/transport/rest/miscendpoint.commit=${BUILD_COMMIT}' \
-X 'github.com/harryzcy/mailbox-browser/bff/transport/rest/miscendpoint.buildDate=${BUILD_DATE}' \
-w -s" \
-o /bin/bff
FROM --platform=$BUILDPLATFORM node:26.3.0-alpine3.23@sha256:144769ec3f32e8ee36b3cfde91e82bee25d9367b20f31a151f3f7eea3a2a8541 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.23.4@sha256:5b10f432ef3da1b8d4c7eb6c487f2f5a8f096bc91145e68878dd4a5019afde11
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"]