Last active
July 24, 2020 15:39
-
-
Save alisonamerico/4f59616dccf895a51d10ffc0ad67aa9b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dockerfile | |
# Pull base image | |
FROM python:3.8.5-buster | |
# python | |
# Set environment variables | |
ENV PYTHONUNBUFFERED 1 | |
# prevents python creating .pyc files | |
ENV PYTHONDONTWRITEBYTECODE=1 | |
# pip | |
ENV PIP_NO_CACHE_DIR=off | |
ENV PIP_DISABLE_PIP_VERSION_CHECK=on | |
ENV PIP_DEFAULT_TIMEOUT=100 | |
# poetry | |
# https://python-poetry.org/docs/configuration/#using-environment-variables | |
ENV POETRY_VERSION=1.0.9 | |
ENV POETRY_VIRTUALENVS_CREATE=false | |
# make poetry create the virtual environment in the project's root | |
# it gets named `.venv` | |
ENV POETRY_VIRTUALENVS_IN_PROJECT=true | |
# do not ask any interactive question | |
ENV POETRY_NO_INTERACTION=1 | |
# Install environment dependencies | |
RUN apt-get update && apt-get -y install apt-utils sudo | |
RUN sudo apt-get -y install binutils libgdal-dev gdal-bin libproj-dev | |
# create folder | |
RUN mkdir /code | |
# Set work directory | |
WORKDIR /code | |
# Install dependencies | |
RUN python -m pip install --upgrade pip | |
RUN pip install poetry | |
COPY pyproject.toml poetry.lock /code/ | |
RUN poetry install | |
# Copy project | |
COPY . /code/ | |
====================================================================================== | |
version: "3.3" | |
services: | |
database: | |
container_name: touristspots_database | |
image: postgis/postgis | |
restart: always | |
volumes: | |
- postgres_data:/var/lib/postgres/data/ | |
environment: | |
- LC_ALL=C.UTF-8 | |
- POSTGRES_USER=snowman | |
- POSTGRES_PASSWORD=snowman | |
- POSTGRES_DB=touristspots | |
ports: | |
- "5433:5432" | |
web: | |
build: . | |
command: python /code/manage.py runserver 0.0.0.0:8000 | |
volumes: | |
- .:/code | |
ports: | |
- "8000:8000" | |
depends_on: | |
- database | |
volumes: | |
postgres_data: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment