mirror of
https://github.com/iritmaximus/timetrials.git
synced 2026-10-12 19:13:48 +03:00
updated both docker files to work on self hosting
This commit is contained in:
+20
-5
@@ -1,11 +1,26 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
FROM python:alpine
|
FROM python:alpine
|
||||||
WORKDIR /app
|
RUN pip install --upgrade pip
|
||||||
|
|
||||||
COPY requirements.txt requirements.txt
|
RUN adduser -D nonroot
|
||||||
RUN pip3 install -r requirements.txt
|
RUN mkdir /home/app/ && chown -R nonroot:nonroot /home/app
|
||||||
|
WORKDIR /home/app
|
||||||
|
USER nonroot
|
||||||
|
|
||||||
COPY . .
|
COPY --chown=nonroot:nonroot requirements.txt requirements.txt
|
||||||
|
|
||||||
CMD [ "gunicorn", "-w", "4", "flaskr:app", "-b", "0.0.0.0:5000", "--access-logfile", "-", "--error-logfile", "-"]
|
# venv
|
||||||
|
ENV VIRTUAL_ENV=/home/app/venv
|
||||||
|
|
||||||
|
# python setup
|
||||||
|
RUN python -m venv $VIRTUAL_ENV
|
||||||
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||||
|
RUN export FLASK_APP=__init__.py
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
COPY --chown=nonroot:nonroot flaskr flaskr
|
||||||
|
|
||||||
|
ENTRYPOINT ["gunicorn"]
|
||||||
|
CMD [ "-w", "4", "flaskr:app", "-b", "0.0.0.0:5000", "--access-logfile", "-", "--error-logfile", "-"]
|
||||||
|
# CMD ["python", "run.py"]
|
||||||
# CMD [ "gunicorn", "-w", "4", "flaskr:app", "-b", "0.0.0.0:5000"]
|
# CMD [ "gunicorn", "-w", "4", "flaskr:app", "-b", "0.0.0.0:5000"]
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
|
version: "2"
|
||||||
services:
|
services:
|
||||||
flask:
|
flask:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
# command: sh -c "gunicorn -w 4 flaskr:app -b 0.0.0.0:5000 --access-logfile '-' --error-logfile '-'"
|
||||||
|
# command: sh -c "ls"
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
volumes:
|
volumes:
|
||||||
Reference in New Issue
Block a user