-
Notifications
You must be signed in to change notification settings - Fork 15
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 #213 from ZeusWPI/feat/docker
Dockerize the application
- Loading branch information
Showing
9 changed files
with
115 additions
and
8 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,10 @@ | ||
# Ignore everything | ||
* | ||
|
||
# Include source, config and scripts | ||
!app | ||
!etc | ||
!*.md | ||
!*.sh | ||
!*.txt | ||
!LICENSE |
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 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM python:3.9.2-slim AS development | ||
|
||
WORKDIR /src | ||
|
||
RUN pip install pymysql | ||
|
||
ADD https://git.zeus.gent/haldis/menus/-/archive/master/menus-master.tar /tmp | ||
RUN mkdir menus && \ | ||
tar --directory=menus --extract --strip-components=1 --file=/tmp/menus-master.tar | ||
|
||
COPY requirements.txt . | ||
RUN pip install -r requirements.txt | ||
|
||
COPY . . | ||
|
||
WORKDIR /src/app | ||
CMD python app.py db upgrade && \ | ||
python app.py runserver -h 0.0.0.0 -p 8000 | ||
|
||
FROM development AS production | ||
|
||
RUN pip install waitress | ||
|
||
CMD python app.py db upgrade && \ | ||
python waitress_wsgi.py |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import sentry_sdk | ||
from sentry_sdk.integrations.flask import FlaskIntegration | ||
from waitress import serve | ||
|
||
from app import create_app | ||
from config import Configuration | ||
|
||
if __name__ == "__main__": | ||
if Configuration.SENTRY_DSN: | ||
sentry_sdk.init( | ||
dsn=Configuration.SENTRY_DSN, | ||
integrations=[FlaskIntegration()] | ||
) | ||
|
||
app, app_mgr = create_app() | ||
serve(app, host="0.0.0.0", port=8000) |
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,17 @@ | ||
version: "3.4" | ||
|
||
services: | ||
app: | ||
build: | ||
target: "development" | ||
environment: | ||
- MARIADB_DATABASE=haldis | ||
- MARIADB_USER=haldis | ||
- MARIADB_PASSWORD=haldis | ||
volumes: ["$PWD:/src"] | ||
database: | ||
environment: | ||
- MARIADB_DATABASE=haldis | ||
- MARIADB_ROOT_PASSWORD=mariadb | ||
- MARIADB_USER=haldis | ||
- MARIADB_PASSWORD=haldis |
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,31 @@ | ||
version: "3.4" | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
target: production | ||
restart: on-failure | ||
depends_on: [database] | ||
ports: ["8000:8000"] | ||
environment: | ||
- MARIADB_HOST=database | ||
- MARIADB_DATABASE | ||
- MARIADB_USER | ||
- MARIADB_PASSWORD | ||
networks: [haldis] | ||
database: | ||
image: mariadb:10.8 | ||
hostname: database | ||
restart: on-failure | ||
environment: | ||
- MARIADB_DATABASE | ||
- MARIADB_ROOT_PASSWORD | ||
- MARIADB_USER | ||
- MARIADB_PASSWORD | ||
networks: [haldis] | ||
volumes: [haldis_data:/var/lib/mysql] | ||
networks: | ||
haldis: | ||
volumes: | ||
haldis_data: |