Skip to content

Commit

Permalink
Use base ubi9 image
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Dec 17, 2024
1 parent 856e4e9 commit c785146
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,29 @@ WORKDIR /backend/
COPY --from=builder /backend ./
COPY --from=builder /venv /venv
COPY --from=builder /usr/share/nltk_data /usr/share/nltk_data/

ENV VIRTUAL_ENV="/venv"
# uWSGI configuration (customize as needed):
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" PYTHONPATH=/backend \
FLASK_APP=app/main.py UWSGI_WSGI_FILE=app/main.py UWSGI_SOCKET=:3031 UWSGI_HTTP=:5001 \
UWSGI_VIRTUALENV=${VIRTUAL_ENV} UWSGI_MASTER=1 UWSGI_WORKERS=4 UWSGI_THREADS=8 UWSGI_MAX_FD=10000 \
UWSGI_LAZY_APPS=1 UWSGI_WSGI_ENV_BEHAVIOR=holy PYTHONDONTWRITEBYTECODE=1

RUN dnf -y upgrade && dnf -y install python3.11 python3.11-pip ca-certificates pcre-devel \
&& dnf clean all \
&& pip install --upgrade pip \
&& pip install --upgrade setuptools \
&& mkdir -p -m 0700 /backend/storage \
&& groupadd uwsgi && useradd -g uwsgi uwsgi \
&& chown -R uwsgi: /usr/share/nltk_data \
&& chown -R uwsgi: /backend
&& chown -R uwsgi:uwsgi ${VIRTUAL_ENV} \
&& chown -R uwsgi:uwsgi /usr/share/nltk_data \
&& chown -R uwsgi:uwsgi /backend

USER uwsgi
EXPOSE 5001
ENV VIRTUAL_ENV="/venv"
# uWSGI configuration (customize as needed):
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" PYTHONPATH=/backend \
FLASK_APP=app/main.py UWSGI_WSGI_FILE=app/main.py UWSGI_SOCKET=:3031 UWSGI_HTTP=:5001 \
UWSGI_VIRTUALENV=${VIRTUAL_ENV} UWSGI_MASTER=1 UWSGI_WORKERS=4 UWSGI_THREADS=8 UWSGI_MAX_FD=10000 UWSGI_LAZY_APPS=1 \
UWSGI_WSGI_ENV_BEHAVIOR=holy PYTHONDONTWRITEBYTECODE=1

RUN mkdir -p -m 0644 /backend/storage \
&& source "${VIRTUAL_ENV}/bin/activate" \
&& pip install --upgrade pip \
&& pip install --upgrade setuptools

# Start uWSGI
CMD ["/venv/bin/uwsgi", "--http-auto-chunked", "--http-keepalive"]
HEALTHCHECK --interval=1m --timeout=5s --retries=2 CMD ["curl", "-s", "-f", "--show-error", "http://localhost:5001/"]

0 comments on commit c785146

Please sign in to comment.