Initial docker-compose setup
This commit is contained in:
parent
db7d4909c7
commit
b5dd97e935
35
docker/Dockerfile
Normal file
35
docker/Dockerfile
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
FROM python:3.7-slim-buster
|
||||||
|
|
||||||
|
ENV PYTHONFAULTHANDLER=1 \
|
||||||
|
PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PYTHONHASHSEED=random \
|
||||||
|
PIP_NO_CACHE_DIR=off \
|
||||||
|
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
||||||
|
PIP_DEFAULT_TIMEOUT=100
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ADD src/requirements/ /tmp/
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y \
|
||||||
|
build-essential \
|
||||||
|
binutils \
|
||||||
|
python3-dev \
|
||||||
|
python3-pip \
|
||||||
|
python3-setuptools \
|
||||||
|
python3-cffi \
|
||||||
|
libxslt-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
libxmlsec1-dev \
|
||||||
|
libpq-dev \
|
||||||
|
libjpeg-dev \
|
||||||
|
libgdal-dev \
|
||||||
|
wkhtmltopdf
|
||||||
|
|
||||||
|
RUN pip3 install --no-cache-dir -r /tmp/dev.txt
|
||||||
|
|
||||||
|
RUN groupadd -g 1000 www
|
||||||
|
RUN useradd -u 1000 -ms /bin/bash -g www www
|
||||||
|
#COPY --chown=www:www ./ /app/
|
30
docker/docker-compose.yml
Normal file
30
docker/docker-compose.yml
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
version: '3.7'
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: app
|
||||||
|
build:
|
||||||
|
context: ../
|
||||||
|
dockerfile: docker/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
tty: true
|
||||||
|
stdin_open: true
|
||||||
|
command: python src/manage.py runserver 0.0.0.0:8000
|
||||||
|
volumes:
|
||||||
|
- ..:/app
|
||||||
|
environment:
|
||||||
|
- DJANGO_DATABASE_NAME=postgres
|
||||||
|
- DJANGO_DATABASE_USER=postgres
|
||||||
|
- DJANGO_DATABASE_PASSWORD=postgres
|
||||||
|
- DJANGO_DATABASE_HOST=db
|
||||||
|
- DJANGO_DATABASE_PORT=5432
|
||||||
|
links:
|
||||||
|
- db
|
||||||
|
db:
|
||||||
|
build:
|
||||||
|
context: postgis_container
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: 'postgres'
|
||||||
|
POSTGRES_PASSWORD: 'postgres'
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
4
docker/postgis_container/00-create-extensions.sh
Normal file
4
docker/postgis_container/00-create-extensions.sh
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname template1 -c "create extension btree_gist"
|
3
docker/postgis_container/Dockerfile
Normal file
3
docker/postgis_container/Dockerfile
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
FROM postgis/postgis:latest
|
||||||
|
|
||||||
|
COPY 00-create-extensions.sh /docker-entrypoint-initdb.d/
|
Loading…
Reference in a new issue