forked from nextstrain/nextclade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
200 lines (165 loc) · 5.22 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# Target: builder
# Purpose: production build environment used in CI and for local testing of the release build
# ubuntu:focal-20210119
# https://hub.docker.com/layers/ubuntu/library/ubuntu/focal-20210119/images/sha256-3093096ee188f8ff4531949b8f6115af4747ec1c58858c091c8cb4579c39cc4e?context=explore
FROM ubuntu@sha256:3093096ee188f8ff4531949b8f6115af4747ec1c58858c091c8cb4579c39cc4e as builder
RUN set -x \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update -qq --yes \
&& apt-get install -qq --no-install-recommends --yes \
autoconf \
automake \
bash \
ccache \
cmake \
coreutils \
cppcheck \
curl \
file \
gdb \
git \
libtool \
make \
meson \
musl \
pkg-config \
pkg-config \
python3 \
python3-pip \
python3-setuptools \
python3-wheel \
unzip \
xz-utils \
>/dev/null \
&& apt-get autoremove --yes >/dev/null \
&& apt-get clean autoclean >/dev/null \
&& rm -rf /var/lib/apt/lists/*
RUN set -x \
&& pip3 install --upgrade --quiet \
colorama \
conan \
cpplint \
&& rm -rf ~/.cache/pip/*
ARG NEXTCLADE_EMSDK_VERSION
COPY scripts/install_emscripten.sh /
RUN set -x \
&& /install_emscripten.sh "/emsdk" "${NEXTCLADE_EMSDK_VERSION}"
ENV TERM="xterm-256color"
ENV HOME="/home/${USER}"
ENV NEXTCLADE_EMSDK_DIR="/emsdk"
ENV NEXTCLADE_EMSDK_VERSION=${NEXTCLADE_EMSDK_VERSION}
WORKDIR /src
#-------------------------------------------------------------------------------
# Target: web
# Purpose: web environment used for production web build
FROM builder as web
ARG NEXTCLADE_NODE_VERSION
ENV TERM="xterm-256color"
ENV NVM_DIR="/opt/nvm"
ENV PATH="${NVM_DIR}/versions/node/default/bin:$PATH"
ENV NEXTCLADE_NVM_DIR="/opt/nvm"
ENV NEXTCLADE_NODE_VERSION="${NEXTCLADE_NODE_VERSION}"
COPY scripts/install_node.sh /
RUN set -x \
&& /install_node.sh "/opt/nvm" "${NEXTCLADE_NODE_VERSION}"
RUN set -x \
&& mkdir /awscli-tmp \
&& cd /awscli-tmp \
&& curl -fsS "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip -oqq awscliv2.zip \
&& ./aws/install --update \
&& rm -rf /awscli-tmp
ENV PATH="${NEXTCLADE_NVM_DIR}/versions/node/default/bin:${HOME}/.local/bin:$PATH"
RUN set -x \
&& mkdir -p "/home/.config/yarn" \
&& npm install -g \
nodemon@2.0.7 \
yarn@1.22.10
WORKDIR /src
#-------------------------------------------------------------------------------
# Target: developer
# Purpose: development environment used for the routine C++ development tasks
FROM builder as developer
USER 0
RUN set -x \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update -qq --yes \
&& apt-get install -qq --no-install-recommends --yes \
build-essential \
clang-format-10 \
clang-tidy \
clang-tools-10 \
curl \
default-jre-headless \
libclang-common-10-dev \
llvm-10 \
sudo \
>/dev/null \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean autoclean >/dev/null \
&& apt-get autoremove --yes >/dev/null
ARG USER=user
ARG GROUP=user
ARG UID
ARG GID
ENV USER=$USER
ENV GROUP=$GROUP
ENV UID=$UID
ENV GID=$GID
ENV TERM="xterm-256color"
ENV HOME="/home/${USER}"
ENV NVM_DIR="${HOME}/.nvm"
ENV PATH="${NVM_DIR}/versions/node/default/bin:${HOME}/.local/bin:$PATH"
RUN set -x \
&& \
if [ -z "$(getent group ${GID})" ]; then \
addgroup --system --gid ${GID} ${GROUP}; \
else \
groupmod -n ${GROUP} $(getent group ${GID} | cut -d: -f1); \
fi \
&& \
if [ -z "$(getent passwd ${UID})" ]; then \
useradd \
--system \
--create-home --home-dir ${HOME} \
--shell /bin/bash \
--gid ${GROUP} \
--groups sudo \
--uid ${UID} \
${USER}; \
fi \
&& sed -i /etc/sudoers -re 's/^%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' \
&& sed -i /etc/sudoers -re 's/^root.*/root ALL=(ALL:ALL) NOPASSWD: ALL/g' \
&& sed -i /etc/sudoers -re 's/^#includedir.*/## **Removed the include directive** ##"/g' \
&& echo "foo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \
&& touch ${HOME}/.hushlogin
RUN set -x \
&& git clone --recursive https://github.com/creationix/nvm.git ${NVM_DIR}
RUN . ${NVM_DIR}/nvm.sh \
&& export NODE_VERSION=$(nvm version-remote --lts) \
&& nvm install ${NODE_VERSION} \
&& nvm alias default ${NODE_VERSION} || true \
&& cd ${NVM_DIR}/versions/node >/dev/null \
&& ln -s ${NODE_VERSION} default \
&& npm install -g nodemon@2.0.6
RUN set -x \
&& chown -R ${USER}:${GROUP} ${HOME}
RUN set -eux >/dev/null \
&& export CSVLINT_VERSION="0.3.0" \
&& export URL="https://github.com/Clever/csvlint/releases/download/v${CSVLINT_VERSION}/csvlint-v${CSVLINT_VERSION}-linux-amd64.tar.gz" \
&& cd / \
&& curl -fsSL "${URL}" | tar -xz -C / \
&& mv "csvlint-v${CSVLINT_VERSION}-linux-amd64/csvlint" "/usr/bin/csvlint"
RUN set -eux >/dev/null \
&& export CSV_VALIDATOR_VERSION="1.1.5" \
&& export URL="https://github.com/digital-preservation/csv-validator/releases/download/${CSV_VALIDATOR_VERSION}/csv-validator-cmd-${CSV_VALIDATOR_VERSION}-application.zip" \
&& cd /tmp \
&& curl -fsSL "${URL}" -o "csv-validator.zip" \
&& unzip "csv-validator.zip" \
&& cp -rv "csv-validator-cmd-${CSV_VALIDATOR_VERSION}/bin/validate" "/usr/bin/csv-validator" \
&& cp -rv "csv-validator-cmd-${CSV_VALIDATOR_VERSION}/lib" "/usr/" \
&& rm -rf /tmp/*
USER ${USER}
WORKDIR /src
ENTRYPOINT ["make", "dev"]
#-------------------------------------------------------------------------------