Pokus o dockerizaci, zatím (snad) ekvivalentní lokální instalaci
This commit is contained in:
parent
fb31b10d66
commit
53a3372e5f
2 changed files with 61 additions and 0 deletions
36
Dockerfile
Normal file
36
Dockerfile
Normal file
|
@ -0,0 +1,36 @@
|
|||
FROM python:3.9.18-slim-bullseye
|
||||
|
||||
# set work directory
|
||||
WORKDIR /usr/src
|
||||
|
||||
# set environment variables
|
||||
ENV PIP_DISABLE_PIP_VERSION_CHECK 1
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
# install dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libpq-dev \
|
||||
gcc \
|
||||
locales \
|
||||
imagemagick
|
||||
RUN pip install --upgrade pip
|
||||
COPY ./requirements.txt .
|
||||
COPY ./constraints.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
# allow correct locales
|
||||
RUN sed -i '/cs_CZ.UTF-8/s/^# //g' /etc/locale.gen && \
|
||||
locale-gen
|
||||
ENV LANG cs_CZ.UTF-8 \
|
||||
LANGUAGE en_US:en \
|
||||
LC_ALL cs_CZ.UTF-8
|
||||
|
||||
# copy project
|
||||
COPY . .
|
||||
|
||||
# create test data
|
||||
RUN ./manage.py testdata
|
||||
RUN ./manage.py loaddata data/*
|
||||
# make/sync_prod_flatpages && \
|
||||
# ./manage.py load_org_permissions deploy_v2/admin_org_prava.json
|
25
docker-compose.yml
Normal file
25
docker-compose.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
# TODO:
|
||||
# - [ ] Pořídit vhodný django settings.py pro docker, aby to používalo postgress
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
command: python manage.py runserver 0.0.0.0:8000
|
||||
volumes:
|
||||
- .:/usr/src
|
||||
ports:
|
||||
- 8000:8000
|
||||
# env_file:
|
||||
# - ./.env.dev
|
||||
|
||||
# db:
|
||||
# image: postgres:13-bullseye
|
||||
# volumes:
|
||||
# - postgres_data:/var/lib/postgresql/data/
|
||||
# environment:
|
||||
# - POSTGRES_USER=hello_django
|
||||
# - POSTGRES_PASSWORD=hello_django
|
||||
# - POSTGRES_DB=hello_django_dev
|
||||
|
||||
# volumes:
|
||||
# postgres_data:
|
Loading…
Reference in a new issue