-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
115 lines (101 loc) · 5.29 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# syntax = docker/dockerfile:1.1.7-experimental
FROM registry-1.docker.io/library/node:14.5.0-stretch-slim AS declare-node-stage
FROM declare-node-stage AS create-working-directory
ENV WORKDIR='/opt/app'
WORKDIR ${WORKDIR}
FROM create-working-directory AS enable-package-caching
ENV DEBIAN_FRONTEND='noninteractive'
RUN rm -f /etc/apt/apt.conf.d/docker-clean; \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
FROM enable-package-caching AS prepare-node-environment
ENV NODE_OPTIONS='--max_old_space_size=6144'
FROM prepare-node-environment AS install-system-dependencies
ENV BASIC_DEPS='ca-certificates apt-transport-https curl' \
BUILD_DEPS='build-essential g++ python make git gnupg' \
CWEBP_DEPS='libglu1 libxi6 libjpeg62 libpng16-16'
ENV DEPS="${BASIC_DEPS} ${BUILD_DEPS} ${CWEBP_DEPS}"
RUN --mount=type=cache,target=/var/cache/apt,id=apt-cache_cache,sharing=locked \
--mount=type=cache,target=/var/cache/debconf,id=debconf-cache_cache,sharing=locked \
--mount=type=cache,target=/var/lib/apt,id=apt-lib_cache,sharing=locked \
apt -y update && apt -y install --no-install-recommends ${DEPS}
FROM install-system-dependencies AS install-latest-npm
RUN --mount=type=cache,target=/root/.npm,id=npm_cache,sharing=locked \
--mount=type=cache,target=/tmp,id=npm_releases,sharing=locked \
npm --prefer-offline install npm --global --silent
FROM install-latest-npm AS prepare-export-environment
ARG CLIENT_ID
ARG CLIENT_EMAIL
ARG PRIVATE_KEY
ARG PROJECT_ID
ARG DATASET_NAME
ARG RUN_ID
ENV NODE_ENV='production'
FROM prepare-export-environment AS install-project-dependencies
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=cache,target=/root/.npm,id=npm_cache,sharing=locked \
--mount=type=cache,target=/tmp,id=npm_releases,sharing=locked \
npm --prefer-offline ci --silent
FROM install-project-dependencies as export-wanted-passports
ENV TABLE='wanted_passports'
ENV SOURCE_ID='ab09ed00-4f51-4f6c-a2f7-1b2fb118be0f'
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=bind,source=/opt/app/node_modules,target=node_modules,from=install-project-dependencies \
--mount=type=bind,source=scripts,target=scripts \
--mount=type=bind,source=src,target=src \
--mount=type=bind,source=config.js,target=config.js \
--mount=type=bind,source=schema.js,target=schema.js \
npm run export
FROM install-project-dependencies as export-invalid-passports
ENV TABLE='invalid_passports'
ENV SOURCE_ID='44e1d462-5de4-40e5-b722-46f2aa9a1e81'
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=bind,source=/opt/app/node_modules,target=node_modules,from=install-project-dependencies \
--mount=type=bind,source=scripts,target=scripts \
--mount=type=bind,source=src,target=src \
--mount=type=bind,source=config.js,target=config.js \
--mount=type=bind,source=schema.js,target=schema.js \
npm run export
FROM install-project-dependencies as export-wanted-intern-passports
ENV TABLE='wanted_intern_passports'
ENV SOURCE_ID='b465b821-db5d-4b8b-8131-12682fab2203'
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=bind,source=/opt/app/node_modules,target=node_modules,from=install-project-dependencies \
--mount=type=bind,source=scripts,target=scripts \
--mount=type=bind,source=src,target=src \
--mount=type=bind,source=config.js,target=config.js \
--mount=type=bind,source=schema.js,target=schema.js \
npm run export
FROM install-project-dependencies as export-invalid-intern-passports
ENV TABLE='invalid_intern_passports'
ENV SOURCE_ID='672e0841-e1a2-47ec-b8d4-22839c71f4b3'
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=bind,source=/opt/app/node_modules,target=node_modules,from=install-project-dependencies \
--mount=type=bind,source=scripts,target=scripts \
--mount=type=bind,source=src,target=src \
--mount=type=bind,source=config.js,target=config.js \
--mount=type=bind,source=schema.js,target=schema.js \
npm run export
FROM scratch AS jobs-done
COPY --from=export-wanted-passports /tmp /tmp
COPY --from=export-invalid-passports /tmp /tmp
COPY --from=export-wanted-intern-passports /tmp /tmp
COPY --from=export-invalid-intern-passports /tmp /tmp
LABEL org.opencontainers.image.description="" \
org.opencontainers.image.is-production="true" \
org.opencontainers.image.version="1.0.0" \
org.opencontainers.image.component="bq" \
org.opencontainers.image.repository="" \
org.opencontainers.image.project="" \
org.opencontainers.image.namespace="" \
org.opencontainers.image.registry="" \
org.opencontainers.image.vendor="" \
org.opencontainers.image.documentation="https://github.com" \
org.opencontainers.image.source="https://github.com" \
org.opencontainers.image.url="https://github.com" \
org.opencontainers.image.title="" \
org.opencontainers.image.licenses=""