-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
124 lines (106 loc) · 3.11 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
116
117
118
119
120
121
122
123
124
# this dockerfile is not for production, its for QA and CI
FROM debian:buster AS utils
# general utils
RUN apt-get update && apt-get install -y \
curl \
git \
jq \
locales \
procps \
unzip \
&& rm -rf /var/lib/apt/lists/*
# using an UTF-8 locale is required for the aws cli
# to successfully list S3 objects with unicode characters
# setup from https://stackoverflow.com/a/28406007
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf awscliv2.zip aws
# node
# this is really excessively complicated logic just so the .nvmrc can be
# the source of truth about our supported node version
COPY .nvmrc /root/.
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash && \
NVM_DIR="$HOME/.nvm" && . $HOME/.nvm/nvm.sh && \
cd && nvm install && \
npm install -g yarn && \
mv $(dirname $(dirname $(which node))) /usr/local/node && \
rm -r "$NVM_DIR"
ENV PATH /usr/local/node/bin:$PATH
FROM utils AS ci
# shellcheck (apt version is very old)
# includes crazy hack around some linking issue from https://github.com/koalaman/shellcheck/issues/1053#issuecomment-357816927
run apt-get update && apt-get install -y \
xz-utils && \
rm -rf /var/lib/apt/lists/* && \
curl -Ls https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz | tar -Jxf - --strip-components=1 -C $HOME shellcheck-stable/shellcheck && \
touch /tmp/libc.so.6 && \
echo "LD_LIBRARY_PATH=/tmp $HOME/shellcheck \"\$@\"" > /usr/bin/shellcheck && \
chmod a+x /usr/bin/shellcheck
# debian deps from https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-doesnt-launch
RUN apt-get update && apt-get install -y \
ca-certificates \
fonts-liberation \
gconf-service \
libappindicator1 \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgbm1 \
libgcc1 \
libgconf-2-4 \
libgdk-pixbuf2.0-0 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
lsb-release \
wget \
xdg-utils \
&& rm -rf /var/lib/apt/lists/*
FROM utils AS release
# Docker trickery so we can reuse the yarn install layer until package.json or yarn.lock change
COPY package.json yarn.lock /code/
WORKDIR /code
RUN yarn install --network-timeout 60000
COPY . /code
ARG BOOKS
ENV BOOKS=${BOOKS}
ARG IMAGE_TAG
ENV IMAGE_TAG=${IMAGE_TAG}
ARG PUBLIC_URL
ENV PUBLIC_URL=${PUBLIC_URL}
ARG REACT_APP_CODE_VERSION
ENV REACT_APP_CODE_VERSION=${REACT_APP_CODE_VERSION}
ARG REACT_APP_RELEASE_ID
ENV REACT_APP_RELEASE_ID=${REACT_APP_RELEASE_ID}
ARG REACT_APP_ENV
ENV REACT_APP_ENV=${REACT_APP_ENV}
RUN yarn build:clean