2020-02-09 22:54:14 +01:00
|
|
|
FROM python:3.8-slim
|
|
|
|
ENV PYTHONUNBUFFERED 1
|
|
|
|
RUN mkdir /code
|
|
|
|
WORKDIR /code
|
|
|
|
|
|
|
|
COPY requirements.txt /code/
|
|
|
|
# install dependencies but ignore any we don't need for dev environment
|
2020-05-26 14:38:33 +02:00
|
|
|
RUN pip install $(grep -ivE "psycopg2" requirements.txt) --no-cache-dir --compile\
|
2020-02-12 04:54:58 +01:00
|
|
|
&& pip install psycopg2-binary --no-cache-dir --compile\
|
|
|
|
&& pip uninstall ipython-genutils pip -y
|
2020-03-14 16:38:13 +01:00
|
|
|
|
|
|
|
COPY package.json /code/
|
|
|
|
COPY yarn.lock /code/
|
|
|
|
COPY webpack.config.js /code/
|
|
|
|
COPY postcss.config.js /code/
|
2020-07-13 11:20:21 +02:00
|
|
|
COPY babel.config.js /code/
|
2020-02-09 22:54:14 +01:00
|
|
|
COPY frontend/ /code/frontend
|
2020-03-14 16:38:13 +01:00
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends curl \
|
2020-02-09 22:54:14 +01:00
|
|
|
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
|
|
|
|
&& apt-get install nodejs -y --no-install-recommends \
|
2020-03-14 16:51:49 +01:00
|
|
|
&& npm install -g yarn@1 \
|
2020-04-13 11:53:37 +02:00
|
|
|
&& yarn config set network-timeout 300000 \
|
2020-03-14 16:51:49 +01:00
|
|
|
&& yarn --frozen-lockfile \
|
|
|
|
&& yarn build \
|
2020-04-07 12:05:15 +02:00
|
|
|
&& yarn cache clean \
|
2020-03-14 16:51:49 +01:00
|
|
|
&& npm uninstall -g yarn \
|
2020-02-09 22:54:14 +01:00
|
|
|
&& apt-get purge -y nodejs curl \
|
|
|
|
&& rm -rf node_modules \
|
|
|
|
&& rm -rf /var/lib/apt/lists/* \
|
2020-03-14 16:38:13 +01:00
|
|
|
&& rm -rf frontend/dist/*.map
|
2020-02-09 22:54:14 +01:00
|
|
|
|
|
|
|
COPY . /code/
|
|
|
|
|
2020-04-07 12:13:39 +02:00
|
|
|
RUN DATABASE_URL='postgres:///' REDIS_URL='redis:///' python manage.py collectstatic --noinput
|
2020-04-02 00:46:29 +02:00
|
|
|
|
2020-02-09 22:54:14 +01:00
|
|
|
EXPOSE 8000
|
2020-03-14 16:38:13 +01:00
|
|
|
CMD ["./bin/docker"]
|