-
Notifications
You must be signed in to change notification settings - Fork 127
/
Dockerfile
67 lines (45 loc) Β· 1.69 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#
# Copyright (c) Microsoft.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
ARG IMAGE_NAME=mcr.microsoft.com/cbl-mariner/base/nodejs:18
FROM $IMAGE_NAME AS build
ARG NPM_TOKEN
RUN tdnf -y update --quiet
# We used to also make Git available for NPM and rsync in build
# tdnf clean all --quiet && \
# tdnf -y install ca-certificates git --quiet && \
WORKDIR /build
COPY . .
# Only if needed, copy file with NPM_TOKEN arg
# COPY .npmrc.arg /build/.npmrc
# RUN npm install --ignore-scripts --production --verbose
RUN npm ci
RUN npm run-script build
RUN mv node_modules production_node_modules
RUN rm -f .npmrc
# The open source project build needs: build the site assets sub-project
RUN cd default-assets-package && npm ci && npm run build
FROM $IMAGE_NAME AS run
ENV IS_DOCKER=1 \
NPM_CONFIG_LOGLEVEL=warn \
DEBUG=startup \
PORT=3000
EXPOSE 3000
WORKDIR /usr/src/repos
# Production Node.js modules
COPY --from=build /build/production_node_modules ./node_modules
# People not using painless config may need
COPY --from=build /build/data ./data
# Copy built assets, app, config map
COPY --from=build /build/dist ./
# The open source project build needs: default assets should be placed
COPY --from=build /build/default-assets-package ./default-assets-package
COPY --from=build /build/config ./config
COPY --from=build /build/views ./views
COPY --from=build /build/package.json ./package.json
# Only if needed, copy our environment
# COPY --from=build /build/.environment ./.environment
# Only if needed, binary resources
# COPY --from=build /build/microsoft/assets ./microsoft/assets
ENTRYPOINT ["npm", "run-script", "start-in-container"]