Skip to content
Snippets Groups Projects
Commit 33ae9a96 authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

make Dockerfile

parent 2b543cb1
No related branches found
No related tags found
No related merge requests found
FROM python:3.11
RUN mkdir /app
WORKDIR /app
# Install NodeJS
ENV NODE_MAJOR=20
RUN apt-get update
RUN apt-get install -y ca-certificates curl gnupg
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update
RUN apt-get install -y nodejs
RUN rm -rf /var/lib/apt/lists/*
COPY . .
RUN pip install -r requirements/base.txt
RUN python manage.py migrate --settings=majak_uistyleguide.settings.production
RUN npm install
RUN npm run prod
# Placeholder values so the static files collect
RUN python manage.py collectstatic --noinput --settings=majak_uistyleguide.settings.production
RUN bash -c "adduser --disabled-login --quiet --gecos app app && \
chmod -R o+r /app/ && \
chmod o+x /app/run.sh"
USER app
ENV DJANGO_SETTINGS_MODULE "majak_uistyleguide.settings.production"
EXPOSE 8000
CMD ["bash", "run.sh"]
bind = "0.0.0.0:8000"
accesslog = "-"
workers = 1
max_requests = 1000
max_requests_jitter = 10
timeout = 60
graceful_timeout = 60
run.sh 0 → 100644
#!/bin/bash
# exit on error
set -e
# migrate database
python manage.py migrate
# start webserver
exec gunicorn -c gunicorn.conf.py majak_uistyleguide.wsgi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment