-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
939e5d5
commit 1258498
Showing
6 changed files
with
315 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM python:3.10 as base | ||
|
||
FROM base as builder | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
build-essential \ | ||
libpq-dev \ | ||
python3-dev | ||
|
||
WORKDIR /install | ||
|
||
COPY pyproject.toml pdm.lock ./ | ||
|
||
RUN pip install --no-cache-dir --upgrade pip \ | ||
&& pip install --no-cache-dir pdm==2.4.8 \ | ||
&& pdm config python.use_venv false | ||
RUN pdm install --prod --no-editable | ||
|
||
FROM base | ||
WORKDIR /usr/src/app | ||
|
||
ENV PATH="/usr/src/python/bin:$PATH" \ | ||
PYTHONPATH="/usr/src/python/lib" | ||
|
||
COPY --from=builder \ | ||
/install/__pypackages__/3.10 \ | ||
/usr/src/python | ||
|
||
COPY backend backend/ | ||
COPY migrations migrations/ | ||
COPY wsgi.py ./ | ||
|
||
CMD ["gunicorn", "-c", "python:backend.gunicorn", "wsgi:app"] |
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,8 @@ | ||
import os | ||
|
||
bind = "0.0.0.0:5000" | ||
worker_class = "gevent" | ||
workers = (os.cpu_count() or 1) * 2 + 1 | ||
threads = (os.cpu_count() or 1) * 2 + 1 | ||
preload = True | ||
timeout = 180 |
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,37 @@ | ||
version: "3.4" | ||
|
||
x-backend-config: &backend | ||
image: localizer-backend:latest | ||
volumes: | ||
- .:/app | ||
depends_on: | ||
- db | ||
env_file: ${ENV_FILE:-localizer.env} | ||
|
||
volumes: | ||
db_data: | ||
|
||
services: | ||
backend: | ||
<<: *backend | ||
container_name: localizer-backend | ||
restart: always | ||
ports: | ||
- "5600:5000" | ||
|
||
migration: | ||
<<: *backend | ||
container_name: localizer-migration | ||
restart: on-failure | ||
command: flask db upgrade | ||
|
||
db: | ||
image: mdillon/postgis:11 | ||
container_name: db | ||
restart: always | ||
env_file: ${ENV_FILE:-localizer.env} | ||
ports: | ||
- "5434:5432" | ||
volumes: | ||
- db_data:/var/lib/postgresql/data | ||
|
Oops, something went wrong.