-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to docker-compose.
- Loading branch information
Showing
14 changed files
with
1,812 additions
and
1,093 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,45 @@ | ||
FROM python:3.8-slim-buster as backend-builder | ||
FROM python:3.11-slim-bookworm as backend-builder | ||
|
||
RUN mkdir /app && mkdir /app/logs | ||
WORKDIR /app | ||
|
||
RUN apt update \ | ||
&& apt install -y --no-install-recommends build-essential make gcc gdal-bin curl wget git \ | ||
&& wget -q https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz && tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.6.1.tar.gz && rm dockerize-linux-amd64-v0.6.1.tar.gz \ | ||
&& apt install -y --no-install-recommends gdal-bin \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean | ||
|
||
ENV POETRY_HOME="/opt/poetry" | ||
RUN curl -sSL https://install.python-poetry.org | python3 - \ | ||
&& find / -name "*.pyc" -exec rm -f {} \; | ||
RUN pip install pdm \ | ||
&& find / -name "*.pyc" -exec rm -f {} \; \ | ||
&& rm -rf /root/.cache/ | ||
|
||
ADD pdm.lock pyproject.toml ./ | ||
|
||
ENV PATH="${PATH}:${POETRY_HOME}/bin" | ||
ADD poetry.lock pyproject.toml /app/ | ||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install --no-dev --no-interaction --no-ansi \ | ||
RUN pdm sync -g -p /app --no-self \ | ||
&& find / -name "*.pyc" -exec rm -f {} \; \ | ||
&& rm -rf /root/.cache/ | ||
|
||
FROM python:3.8-slim-buster as backend | ||
FROM python:3.11-slim-bookworm as backend | ||
|
||
RUN apt update \ | ||
&& apt install -y --no-install-recommends gdal-bin \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean | ||
|
||
COPY --from=backend-builder /usr/local/lib/python3.8/site-packages/ /usr/local/lib/python3.8/site-packages/ | ||
COPY --from=backend-builder /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/ | ||
COPY --from=backend-builder /usr/local/bin/ /usr/local/bin/ | ||
|
||
ARG GIT_REVISION | ||
ENV GIT_REVISION=${GIT_REVISION:-unknown} | ||
|
||
WORKDIR /app | ||
|
||
ADD . /app/ | ||
ADD . . | ||
CMD ["python3"] | ||
|
||
|
||
FROM backend-builder as backend-tester | ||
|
||
WORKDIR /app | ||
|
||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install --no-interaction --no-ansi \ | ||
RUN pdm sync -g -p /app --no-self --dev \ | ||
&& find / -name "*.pyc" -exec rm -f {} \; \ | ||
&& rm -rf /root/.cache/ |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
version: '3.8' | ||
services: | ||
redis: | ||
image: redis:5-alpine | ||
healthcheck: | ||
test: ["CMD", "redis-cli", "ping"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 | ||
networks: | ||
- webnet | ||
|
||
postgres: | ||
image: circleci/postgres:12-postgis | ||
environment: | ||
POSTGRES_USER: geopuzzle | ||
POSTGRES_PASSWORD: geopuzzle | ||
POSTGRES_DB: geopuzzle | ||
healthcheck: | ||
test: ["CMD", "pg_isready -U geopuzzle"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 | ||
volumes: | ||
- ./pgdata:/var/lib/postgresql/data | ||
networks: | ||
- webnet | ||
|
||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.backend | ||
target: backend | ||
restart: on-failure | ||
environment: | ||
DJANGO_SETTINGS_MODULE: mercator.settings.development | ||
SECRET_KEY: 123 | ||
|
||
POSTGRES_HOST: postgres | ||
POSTGRES_PORT: 5432 | ||
POSTGRES_DB: geopuzzle | ||
POSTGRES_USER: geopuzzle | ||
POSTGRES_PASSWORD: geopuzzle | ||
|
||
REDIS_HOST: redis | ||
ports: | ||
- 8000:8000 | ||
depends_on: | ||
- postgres | ||
- redis | ||
links: | ||
- postgres | ||
- redis | ||
networks: | ||
- webnet | ||
volumes: | ||
- .:/app | ||
command: ./manage.py runserver 0.0.0.0:8000 | ||
|
||
networks: | ||
webnet: | ||
|
||
volumes: | ||
pgdata: |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
from pathlib import Path | ||
|
||
import dotenv | ||
from django.core.wsgi import get_wsgi_application | ||
|
||
|
||
dotenv.read_dotenv(Path(__file__).resolve().parent.parent / '.env') | ||
|
||
application = get_wsgi_application() |
Oops, something went wrong.