-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (39 loc) · 1.01 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
46
47
48
# SPDX-License-Identifier: Apache-2.0
ARG BUILD_IMAGE=node:20-bullseye
ARG RUN_IMAGE=gcr.io/distroless/nodejs20-debian11:nonroot
#ARG RUN_IMAGE=node:21-alpine
FROM ${BUILD_IMAGE} AS builder
LABEL stage=build
# TS -> JS stage
WORKDIR /home/app
COPY ./src ./src
COPY ./package*.json ./
COPY ./tsconfig.json ./
COPY .npmrc ./
ARG GH_TOKEN
RUN npm ci --ignore-scripts
RUN npm run build
FROM ${BUILD_IMAGE} AS dep-resolver
LABEL stage=pre-prod
# To filter out dev dependencies from final build
COPY package*.json ./
COPY .npmrc ./
ARG GH_TOKEN
RUN npm ci --omit=dev --ignore-scripts
FROM ${RUN_IMAGE} AS run-env
USER nonroot
WORKDIR /home/app
COPY --from=dep-resolver /node_modules ./node_modules
COPY --from=builder /home/app/build ./build
COPY package.json ./
ENV NATS_SERVER=localhost:4222
ENV NATS_SUBJECT=Lumberjack
ENV ELASTIC_INDEX=logs-tazama
ENV ELASTIC_USERNAME=
ENV ELASTIC_PASSWORD=
ENV ELASTIC_SEARCH_VERSION=
ENV ELASTIC_HOST=
ENV ELASTIC_FLUSH_BYTES=1000
ENV STDOUT=false
ENV ELASTIC=true
CMD ["build/index.js"]