-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
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.24.2@sha256:991aa6a6e4431f2f01e869a812934bd60fbc87fb939e4a1ea54b8494ab9d2fc6 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.11.0-alpine3.20@sha256:45b0799541e0fa993516a147bd9c59a5c2b81ec06cfb8f6e6e18d222f2780e23 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.3@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c
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"]