Reorganize repos
This commit is contained in:
36
docker/Dockerfile
Normal file
36
docker/Dockerfile
Normal file
@ -0,0 +1,36 @@
|
||||
# syntax = docker/dockerfile:1.2
|
||||
FROM python:3.12.2-alpine3.19
|
||||
|
||||
ARG APP_VERSION
|
||||
ARG APP_SHA
|
||||
ARG BUILD_DATE
|
||||
|
||||
ENV APP_VERSION=${APP_VERSION:-alpha0}
|
||||
ENV APP_SHA=${APP_SHA:-000000}
|
||||
# useful in case we want to run in debug mode
|
||||
ENV FLASK_APP /hsman/wsgi.py
|
||||
ENV FLASK_ENV production
|
||||
|
||||
RUN apk --update --no-cache add \
|
||||
bash \
|
||||
build-base \
|
||||
libffi-dev \
|
||||
curl && \
|
||||
chmod g+w /run && \
|
||||
pip install poetry gunicorn
|
||||
|
||||
COPY . /hsman
|
||||
|
||||
RUN cd hsman && \
|
||||
poetry install && \
|
||||
poetry export | pip install -r /dev/stdin
|
||||
|
||||
|
||||
WORKDIR /hsman
|
||||
|
||||
HEALTHCHECK --interval=20s --timeout=3s CMD curl -I -s -o /dev/null localhost:5000/health || exit 1
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
# exectute start up script
|
||||
ENTRYPOINT ["/hsman/docker/entrypoint.sh"]
|
16
docker/entrypoint.sh
Executable file
16
docker/entrypoint.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
exec $*
|
||||
fi
|
||||
|
||||
echo Starting ${APP_VERSION}
|
||||
|
||||
if [ $FLASK_ENV == "development" ]; then
|
||||
echo "Running app in debug mode"
|
||||
export FLASK_DEBUG=1
|
||||
flask run --host 0.0.0.0
|
||||
else
|
||||
echo "Running app in production mode"
|
||||
gunicorn wsgi:app --config gunicorn.conf.py
|
||||
fi
|
Reference in New Issue
Block a user