Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (38 loc) · 1.79 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (38 loc) · 1.79 KB
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
FROM python:3.11
LABEL maintainer="llindstrom@lco.global"
# the exposed port must match the deployment.yaml containerPort value
EXPOSE 80
ENTRYPOINT [ "poetry", "run", "gunicorn", "tom_demo_base.wsgi", "-b", "0.0.0.0:80", "--access-logfile", "-", "--error-logfile", "-", "-k", "gevent", "--timeout", "300", "--workers", "2"]
WORKDIR /tom-demo
RUN pip install --upgrade pip && pip install 'poetry >=2.0,<3.0'
COPY . /tom-demo
# tell poetry: do NOT create a virtual env; should install everything globally
RUN poetry config virtualenvs.create false --local
# tell poetry: even if you find a virtual env, don't use it; install everything globally
RUN poetry config virtualenvs.in-project false --local
# now have poetry install dependencies according to pyproject.toml
RUN poetry install -vv --no-interaction
# this just adds some debugging info to the logs
RUN pip freeze
# continue to setup the image with node and npm install (via nvm)
# see https://stackoverflow.com/questions/25899912/
# Use bash for subsequent RUN, CMD, ENTRYPOINT commands
SHELL ["/bin/bash", "--login", "-c"]
ENV NVM_DIR=/usr/local/nvm
RUN mkdir -p $NVM_DIR
ENV NODE_VERSION=14.17.0
# Install nvm with node and npm
RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.38.0/install.sh | bash \
&& source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
ENV NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
# write new webpack-stats.json for django-webpack-loader to use
# and install the Vue JS/CSS etc as static files
WORKDIR /tom-demo/vue
RUN npm install && npm run build
WORKDIR /tom-demo
# this should put the vue.js components in an accessible place
RUN poetry run python manage.py collectstatic --noinput