-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
69 lines (58 loc) · 1.85 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
ARG NODE_IMG=node
ARG NODE_VER_NAME=lts-gallium
ARG PY_IMG=python
FROM ${NODE_IMG}:${NODE_VER_NAME} AS client
WORKDIR /project
COPY package.json yarn.lock ./
RUN yarn install --network-timeout 1000000
COPY . ./
RUN yarn build --production
FROM ${PY_IMG}:3.10.11
# Set shell to use for run commands
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
# Install apt packages
RUN apt-get update && apt-get install --no-install-recommends -y \
gettext \
curl \
build-essential \
nodejs \
ruby \
ruby-dev \
default-mysql-client \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# Install SASS requirements
# These are pinned because compass is decommissioned and thus tricky to get working.
# These versions were chosen because they were used
# in the latest functioning portal image at the time of this edit.
&& gem install sass --version 3.4.23 \
&& gem install compass --version 1.0.3
# install python dependencies
WORKDIR /setup
# BUG: this is not being carried over from the builder somehow
COPY package.json yarn.lock ./
# uglify-js: for JS compression
# yuglify: for CSS compression
RUN npm install -g \
uglify-js \
yuglify
# Use pip to install poetry. We don't use virtualenvs in the build context.
# Therefore, the vendored install provides no additional isolation.
RUN pip install --upgrade pip && \
pip install \
poetry~=1.2
COPY poetry.lock pyproject.toml /setup/
ENV POETRY_VIRTUALENVS_CREATE=false
RUN poetry install --no-root --only main
RUN mkdir /var/log/django
VOLUME ["/media"]
VOLUME ["/static"]
COPY . /project
WORKDIR /project
# translation messages, if necessary
RUN python manage.py compilemessages
# copy compiled JS assets
COPY --from=client /project/static/vue /project/static/vue
COPY --from=client /project/webpack-stats.json /project/webpack-stats.json
EXPOSE 80 443