2020-09-23 10:51:44 +03:00
|
|
|
FROM node:12-slim
|
2016-03-02 07:13:17 +03:00
|
|
|
|
|
|
|
# Install node_modules into a different directory to avoid npm/npm#9863.
|
|
|
|
RUN mkdir -p /srv/node
|
2018-09-10 17:16:25 +03:00
|
|
|
COPY package.json /srv/node/
|
|
|
|
COPY yarn.lock /srv/node/
|
2016-03-02 07:13:17 +03:00
|
|
|
WORKDIR /srv/node
|
2017-01-27 01:33:43 +03:00
|
|
|
|
2017-08-31 20:08:00 +03:00
|
|
|
# This file has been downloaded from: https://dl.yarnpkg.com/debian/pubkey.gpg
|
|
|
|
COPY docker/etc/pki/yarnpkg.gpg.key /etc/pki/yarnpkg.gpg.key
|
|
|
|
|
2017-01-27 01:33:43 +03:00
|
|
|
RUN buildDeps=' \
|
|
|
|
git \
|
2017-08-30 20:50:00 +03:00
|
|
|
yarn \
|
2019-01-17 13:01:32 +03:00
|
|
|
python \
|
|
|
|
build-essential \
|
2017-01-27 01:33:43 +03:00
|
|
|
' && \
|
2017-08-30 20:50:00 +03:00
|
|
|
# `apt-transport-https` is required to use https deb repositories
|
|
|
|
apt-get update -y && \
|
2020-01-10 17:09:16 +03:00
|
|
|
apt-get install -y --no-install-recommends gnupg ca-certificates apt-transport-https && \
|
2017-08-30 20:50:00 +03:00
|
|
|
# configure Yarn repository, see: https://yarnpkg.com/en/docs/install#linux-tab
|
2017-08-31 20:08:00 +03:00
|
|
|
apt-key add /etc/pki/yarnpkg.gpg.key && \
|
2017-08-30 20:50:00 +03:00
|
|
|
echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && \
|
|
|
|
# the base image installs yarn, let's be sure we use ours
|
|
|
|
rm -f /usr/local/bin/yarn /usr/local/bin/yarnpkg && \
|
2017-01-27 01:33:43 +03:00
|
|
|
# install deps
|
|
|
|
apt-get update -y && \
|
|
|
|
apt-get install -y --no-install-recommends $buildDeps && \
|
2018-09-10 17:16:25 +03:00
|
|
|
yarn install --pure-lockfile && \
|
2017-01-27 01:33:43 +03:00
|
|
|
# cleanup
|
|
|
|
# apt-get purge -y $buildDeps && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
2016-03-02 07:13:17 +03:00
|
|
|
|
2018-09-10 17:16:25 +03:00
|
|
|
COPY . /srv/code/
|
2016-03-02 07:13:17 +03:00
|
|
|
WORKDIR /srv/code
|
|
|
|
|
2017-01-31 20:30:50 +03:00
|
|
|
# The V2 Pipeline expects version.json to be located in /app/
|
|
|
|
# As a temporary measure symlink to the version.json generated by Circle-CI
|
|
|
|
RUN mkdir /app && ln -s /srv/code/version.json /app/version.json
|
|
|
|
|
2016-03-02 07:13:17 +03:00
|
|
|
# Replace the local node_modules with the ones we installed above.
|
|
|
|
RUN rm -rf node_modules
|
|
|
|
RUN ln -s /srv/node/node_modules
|
|
|
|
|
|
|
|
ENV SERVER_HOST 0.0.0.0
|
|
|
|
ENV SERVER_PORT 4000
|
|
|
|
|
2017-08-30 20:50:00 +03:00
|
|
|
CMD yarn start
|