Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alisonamerico/80eb40bd2df95211de6f513a9a95f9d2 to your computer and use it in GitHub Desktop.
Save alisonamerico/80eb40bd2df95211de6f513a9a95f9d2 to your computer and use it in GitHub Desktop.
docker configs
# docker-compose.yml
version: "3.3"
services:
database:
container_name: touristspots_database
image: postgis/postgis
restart: always
volumes:
- ./.pgdata:/var/lib/postgres/data
environment:
- LC_ALL=C.UTF-8
- POSTGRES_USER=snowman
- POSTGRES_PASSWORD=snowman
ports:
- 5433:5432
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- database
===========================================================================================================
# Dockerfile
# Pull base image
FROM python:3.8.5-buster
# Set environment variables
ENV PYTHONUNBUFFERED 1
# User
USER root
# Install environment dependencies
RUN sudo -u root apt-get update && sudo -u root apt-get --assume-yes 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 poetry.lock pyproject.toml /code/
RUN poetry install
# Copy project
COPY . /code/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment