-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #185 from afids/docker
Set up Docker compose
- Loading branch information
Showing
11 changed files
with
209 additions
and
114 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,8 @@ | ||
dist | ||
__pycache__ | ||
Dockerfile | ||
compose | ||
compose.yaml | ||
.git | ||
uploads | ||
test |
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,28 @@ | ||
FROM debian:bullseye as packaging | ||
ENV PATH=/root/.local/bin:$PATH | ||
RUN echo "deb http://deb.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list \ | ||
&& apt-get update -qq \ | ||
&& apt-get install -y -q --no-install-recommends \ | ||
python3=3.9.2-3 \ | ||
python3-pip=20.3.4-4+deb11u1 \ | ||
&& apt-get install -y -q --no-install-recommends -t bullseye-backports pipx=1.0.0-1~bpo11+1 \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ | ||
&& pipx ensurepath \ | ||
&& pipx install poetry==1.2.2 | ||
WORKDIR /apps/afidsvalidator | ||
COPY . . | ||
RUN poetry build | ||
|
||
FROM debian:bullseye as deploy | ||
RUN apt-get update -qq \ | ||
&& apt-get install -y -q --no-install-recommends \ | ||
build-essential=12.9 \ | ||
gcc=4:10.2.1-1 \ | ||
python3=3.9.2-3 \ | ||
python3-dev=3.9.2-3 \ | ||
python3-pip=20.3.4-4+deb11u1 \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
WORKDIR /apps/afidsvalidator | ||
COPY --from=packaging /apps/afidsvalidator/dist/afidsvalidator-*-py3-none-any.whl /apps/wheels/ | ||
RUN pip install --no-cache-dir `ls /apps/wheels/*.whl`[deploy] | ||
ENTRYPOINT ["uwsgi", "-w", "afidsvalidator.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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from afidsvalidator import create_app | ||
|
||
app = create_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,26 @@ | ||
services: | ||
afidsvalidator: | ||
build: . | ||
environment: | ||
DATABASE_URL: postgresql+psycopg2://postgres:example@postgres:5432 | ||
UWSGI_SOCKET: 0.0.0.0:5000 | ||
FLASK_ENV: development | ||
ports: ["5000:5000"] | ||
depends_on: | ||
- postgres | ||
postgres: | ||
image: postgres:11 | ||
restart: unless-stopped | ||
environment: | ||
POSTGRES_PASSWORD: example | ||
volumes: | ||
- "./compose/postgres-db:/var/lib/postgresql/data" | ||
ports: ["5432:5432"] | ||
nginx: | ||
image: nginx:latest | ||
hostname: nginx | ||
volumes: | ||
- "./compose/nginx.conf:/etc/nginx/nginx.conf" | ||
ports: ["5001:80"] | ||
depends_on: | ||
- afidsvalidator |
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,14 @@ | ||
events { | ||
worker_connections 4096; ## Default: 1024 | ||
} | ||
|
||
http { | ||
server { | ||
listen 80; | ||
server_name nginx; | ||
location / { | ||
include uwsgi_params; | ||
uwsgi_pass afidsvalidator:5000; | ||
} | ||
} | ||
} |
Oops, something went wrong.