diff --git a/.env b/.env.sample similarity index 78% rename from .env rename to .env.sample index 28e04da..af02bfa 100644 --- a/.env +++ b/.env.sample @@ -1,4 +1,4 @@ -FLASK_APP=main.py +FLASK_APP=app FLASK_ENV=development FLASK_RUN_PORT=8080 FLASK_RUN_HOST=0.0.0.0 \ No newline at end of file diff --git a/.gitignore b/.gitignore index ba0430d..1541da5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -__pycache__/ \ No newline at end of file +__pycache__/ +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4cb050d..995f718 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,15 @@ -FROM node:current-alpine -COPY . /app/ -WORKDIR /app -ENV NODE_ENV=production -RUN yarn install && yarn build && rm -rf node_modules - - FROM python:3-slim-buster ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 -ENV DATABASE_URL sqlite:////data/app.db -ENV FLASK_APP app -ENV FLASK_DEBUG 0 +ENV FLASK_ENV production COPY ./requirements.txt /requirements.txt RUN apt-get update && \ apt-get install -y gosu && \ rm -rf /var/lib/apt/lists/* && \ - pip install -r /requirements.txt && pip install gunicorn -COPY --from=0 /app/ /app -WORKDIR /app -RUN flask digest compile -ENTRYPOINT ["/app/entrypoint.sh"] -CMD ["gunicorn", "--bind", "0.0.0.0:5000", "main:app"] + pip install -r /requirements.txt +COPY ./app/ /app +WORKDIR / +COPY ./entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] +CMD ["gunicorn", "--chdir", "/app", "--bind", "0.0.0.0:5000", "app:app"] diff --git a/Pipfile b/Pipfile index 4416d22..bf78d5f 100644 --- a/Pipfile +++ b/Pipfile @@ -6,6 +6,7 @@ name = "pypi" [packages] flask = "*" flask-sqlalchemy = "*" +gunicorn = "*" [dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock index cb3969d..a20753f 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "0304580c13b25ebde937a6853a2a3203f7473be71f8c1d376351033a4d9fce06" + "sha256": "f25cb8ce895349e90f87c3ccb19ff91c7a64ae9114ed70cd9bc99f6734425057" }, "pipfile-spec": 6, "requires": { @@ -39,6 +39,14 @@ "index": "pypi", "version": "==2.4.4" }, + "gunicorn": { + "hashes": [ + "sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626", + "sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c" + ], + "index": "pypi", + "version": "==20.0.4" + }, "itsdangerous": { "hashes": [ "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19", @@ -93,40 +101,46 @@ }, "sqlalchemy": { "hashes": [ - "sha256:072766c3bd09294d716b2d114d46ffc5ccf8ea0b714a4e1c48253014b771c6bb", - "sha256:107d4af989831d7b091e382d192955679ec07a9209996bf8090f1f539ffc5804", - "sha256:15c0bcd3c14f4086701c33a9e87e2c7ceb3bcb4a246cd88ec54a49cf2a5bd1a6", - "sha256:26c5ca9d09f0e21b8671a32f7d83caad5be1f6ff45eef5ec2f6fd0db85fc5dc0", - "sha256:276936d41111a501cf4a1a0543e25449108d87e9f8c94714f7660eaea89ae5fe", - "sha256:3292a28344922415f939ee7f4fc0c186f3d5a0bf02192ceabd4f1129d71b08de", - "sha256:33d29ae8f1dc7c75b191bb6833f55a19c932514b9b5ce8c3ab9bc3047da5db36", - "sha256:3bba2e9fbedb0511769780fe1d63007081008c5c2d7d715e91858c94dbaa260e", - "sha256:465c999ef30b1c7525f81330184121521418a67189053bcf585824d833c05b66", - "sha256:51064ee7938526bab92acd049d41a1dc797422256086b39c08bafeffb9d304c6", - "sha256:5a49e8473b1ab1228302ed27365ea0fadd4bf44bc0f9e73fe38e10fdd3d6b4fc", - "sha256:618db68745682f64cedc96ca93707805d1f3a031747b5a0d8e150cfd5055ae4d", - "sha256:6547b27698b5b3bbfc5210233bd9523de849b2bb8a0329cd754c9308fc8a05ce", - "sha256:6557af9e0d23f46b8cd56f8af08eaac72d2e3c632ac8d5cf4e20215a8dca7cea", - "sha256:73a40d4fcd35fdedce07b5885905753d5d4edf413fbe53544dd871f27d48bd4f", - "sha256:8280f9dae4adb5889ce0bb3ec6a541bf05434db5f9ab7673078c00713d148365", - "sha256:83469ad15262402b0e0974e612546bc0b05f379b5aa9072ebf66d0f8fef16bea", - "sha256:860d0fe234922fd5552b7f807fbb039e3e7ca58c18c8d38aa0d0a95ddf4f6c23", - "sha256:883c9fb62cebd1e7126dd683222b3b919657590c3e2db33bdc50ebbad53e0338", - "sha256:8afcb6f4064d234a43fea108859942d9795c4060ed0fbd9082b0f280181a15c1", - "sha256:96f51489ac187f4bab588cf51f9ff2d40b6d170ac9a4270ffaed535c8404256b", - "sha256:9e865835e36dfbb1873b65e722ea627c096c11b05f796831e3a9b542926e979e", - "sha256:aa0554495fe06172b550098909be8db79b5accdf6ffb59611900bea345df5eba", - "sha256:b595e71c51657f9ee3235db8b53d0b57c09eee74dfb5b77edff0e46d2218dc02", - "sha256:b6ff91356354b7ff3bd208adcf875056d3d886ed7cef90c571aef2ab8a554b12", - "sha256:b70bad2f1a5bd3460746c3fb3ab69e4e0eb5f59d977a23f9b66e5bdc74d97b86", - "sha256:c7adb1f69a80573698c2def5ead584138ca00fff4ad9785a4b0b2bf927ba308d", - "sha256:c898b3ebcc9eae7b36bd0b4bbbafce2d8076680f6868bcbacee2d39a7a9726a7", - "sha256:e49947d583fe4d29af528677e4f0aa21f5e535ca2ae69c48270ebebd0d8843c0", - "sha256:eb1d71643e4154398b02e88a42fc8b29db8c44ce4134cf0f4474bfc5cb5d4dac", - "sha256:f2e8a9c0c8813a468aa659a01af6592f71cd30237ec27c4cc0683f089f90dcfc", - "sha256:fe7fe11019fc3e6600819775a7d55abc5446dda07e9795f5954fdbf8a49e1c37" + "sha256:009e8388d4d551a2107632921320886650b46332f61dc935e70c8bcf37d8e0d6", + "sha256:0157c269701d88f5faf1fa0e4560e4d814f210c01a5b55df3cab95e9346a8bcc", + "sha256:0a92745bb1ebbcb3985ed7bda379b94627f0edbc6c82e9e4bac4fb5647ae609a", + "sha256:0cca1844ba870e81c03633a99aa3dc62256fb96323431a5dec7d4e503c26372d", + "sha256:166917a729b9226decff29416f212c516227c2eb8a9c9f920d69ced24e30109f", + "sha256:1f5f369202912be72fdf9a8f25067a5ece31a2b38507bb869306f173336348da", + "sha256:2909dffe5c9a615b7e6c92d1ac2d31e3026dc436440a4f750f4749d114d88ceb", + "sha256:2b5dafed97f778e9901b79cc01b88d39c605e0545b4541f2551a2fd785adc15b", + "sha256:2e9bd5b23bba8ae8ce4219c9333974ff5e103c857d9ff0e4b73dc4cb244c7d86", + "sha256:3aa6d45e149a16aa1f0c46816397e12313d5e37f22205c26e06975e150ffcf2a", + "sha256:4bdbdb8ca577c6c366d15791747c1de6ab14529115a2eb52774240c412a7b403", + "sha256:53fd857c6c8ffc0aa6a5a3a2619f6a74247e42ec9e46b836a8ffa4abe7aab327", + "sha256:5cdfe54c1e37279dc70d92815464b77cd8ee30725adc9350f06074f91dbfeed2", + "sha256:5d92c18458a4aa27497a986038d5d797b5279268a2de303cd00910658e8d149c", + "sha256:632b32183c0cb0053194a4085c304bc2320e5299f77e3024556fa2aa395c2a8b", + "sha256:7c735c7a6db8ee9554a3935e741cf288f7dcbe8706320251eb38c412e6a4281d", + "sha256:7cd40cb4bc50d9e87b3540b23df6e6b24821ba7e1f305c1492b0806c33dbdbec", + "sha256:84f0ac4a09971536b38cc5d515d6add7926a7e13baa25135a1dbb6afa351a376", + "sha256:8dcbf377529a9af167cbfc5b8acec0fadd7c2357fc282a1494c222d3abfc9629", + "sha256:950f0e17ffba7a7ceb0dd056567bc5ade22a11a75920b0e8298865dc28c0eff6", + "sha256:9e379674728f43a0cd95c423ac0e95262500f9bfd81d33b999daa8ea1756d162", + "sha256:b15002b9788ffe84e42baffc334739d3b68008a973d65fad0a410ca5d0531980", + "sha256:b6f036ecc017ec2e2cc2a40615b41850dc7aaaea6a932628c0afc73ab98ba3fb", + "sha256:bad73f9888d30f9e1d57ac8829f8a12091bdee4949b91db279569774a866a18e", + "sha256:bbc58fca72ce45a64bb02b87f73df58e29848b693869e58bd890b2ddbb42d83b", + "sha256:bca4d367a725694dae3dfdc86cf1d1622b9f414e70bd19651f5ac4fb3aa96d61", + "sha256:be41d5de7a8e241864189b7530ca4aaf56a5204332caa70555c2d96379e18079", + "sha256:bf53d8dddfc3e53a5bda65f7f4aa40fae306843641e3e8e701c18a5609471edf", + "sha256:c092fe282de83d48e64d306b4bce03114859cdbfe19bf8a978a78a0d44ddadb1", + "sha256:c3ab23ee9674336654bf9cac30eb75ac6acb9150dc4b1391bec533a7a4126471", + "sha256:ce64a44c867d128ab8e675f587aae7f61bd2db836a3c4ba522d884cd7c298a77", + "sha256:d05cef4a164b44ffda58200efcb22355350979e000828479971ebca49b82ddb1", + "sha256:d2f25c7f410338d31666d7ddedfa67570900e248b940d186b48461bd4e5569a1", + "sha256:d3b709d64b5cf064972b3763b47139e4a0dc4ae28a36437757f7663f67b99710", + "sha256:e32e3455db14602b6117f0f422f46bc297a3853ae2c322ecd1e2c4c04daf6ed5", + "sha256:ed53209b5f0f383acb49a927179fa51a6e2259878e164273ebc6815f3a752465", + "sha256:f605f348f4e6a2ba00acb3399c71d213b92f27f2383fc4abebf7a37368c12142", + "sha256:fcdb3755a7c355bc29df1b5e6fb8226d5c8b90551d202d69d0076a8a5649d68b" ], - "version": "==1.3.19" + "version": "==1.3.20" }, "werkzeug": { "hashes": [ diff --git a/entrypoint.sh b/entrypoint.sh old mode 100644 new mode 100755 index 5c14664..2cbee87 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,3 @@ #!/bin/bash chown -R www-data:www-data /data -flask db upgrade && gosu www-data "$@" \ No newline at end of file +gosu www-data "$@" \ No newline at end of file