Make docker default configuration production ready
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
9d10f4f5b9
commit
1782a97bcb
4 changed files with 11 additions and 7 deletions
1
.snipenv
1
.snipenv
|
@ -1 +0,0 @@
|
|||
SNIP_STAGE=local
|
11
Dockerfile
11
Dockerfile
|
@ -3,15 +3,16 @@ FROM python:3.8-alpine
|
|||
RUN apk update && apk add su-exec \
|
||||
&& pip3 install pipenv
|
||||
|
||||
RUN mkdir -p /data
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
RUN pipenv install
|
||||
|
||||
ENV FLASK_APP=snip
|
||||
ENV FLASK_ENV=production
|
||||
|
||||
RUN ["pipenv", "run", "python", "-c", "from snip import db; db.create_all()"]
|
||||
ENV SNIP_DATABASE="sqlite"
|
||||
ENV SNIP_DATABASE_URI="sqlite:////data/snip.db"
|
||||
ENV SNIP_FLASK_HOST="0.0.0.0"
|
||||
|
||||
EXPOSE 5000
|
||||
CMD ["pipenv", "run", "flask", "run", "--host=0.0.0.0"]
|
||||
CMD ["pipenv", "run", "python", "-m", "snip"]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from . import app
|
||||
from . import snip_config
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
app.run(host=snip_config.SNIP_FLASK_HOST, port=snip_config.SNIP_FLASK_PORT)
|
||||
|
|
|
@ -43,6 +43,9 @@ class SnipConfig(BaseModel):
|
|||
SNIP_FLASK_ENVIRONMENT: Literal['development', 'production'] = 'production'
|
||||
SNIP_FLASK_DEBUG: bool = False
|
||||
SNIP_FLASK_SKIP_DOTENV: int = 1
|
||||
# Non-standard flask settings
|
||||
SNIP_FLASK_HOST: str = "localhost"
|
||||
SNIP_FLASK_PORT: int = 5000
|
||||
|
||||
# Snip settings
|
||||
SNIP_STAGE: Optional[str]
|
||||
|
|
Loading…
Add table
Reference in a new issue