forked from dingkeyan93/Intrinsic-Image-Popularity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
72 lines (50 loc) · 2.07 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Use the official lightweight Python image.
# https://hub.docker.com/_/python
# syntax=docker/dockerfile:experimental
FROM python:3.10.14 as builder
# Allow statements and log messages to immediately appear in the Knative logs
ENV PYTHONUNBUFFERED True
ARG AWS_ACCESS_KEY
ARG AWS_SECRET_KEY
ENV PIPENV_VENV_IN_PROJECT=1
ENV PIPENV_CACHE_DIR=/home/root/.cache/pipenv
ENV AWS_CONFIG_FILE /.aws/config
RUN mkdir -pv -m 700 /iipa-workspace
ENV APP_HOME /iipa-workspace
WORKDIR $APP_HOME
ADD Pipfile.lock Pipfile ${APP_HOME}/
WORKDIR $APP_HOME
# Install production dependencies.
RUN pip install pipenv
RUN --mount=type=cache,target=/home/root/.cache/pipenv pipenv install
# # Run the web service on container startup. Here we use the gunicorn
# # webserver, with one worker process and 8 threads.
# # For environments with multiple CPU cores, increase the number of workers
# # to be equal to the cores available.
FROM python:3.10.14 as runtime
RUN pip install pipenv
RUN mkdir -pv -m 700 /iipa-workspace
ENV APP_HOME /iipa-workspace
WORKDIR $APP_HOME/
COPY ./ $APP_HOME/
# RUN mkdir -pv -m 700 .venv
# RUN mkdir -pv -m 700 django-polls
COPY --from=builder /iipa-workspace/.venv/ ${APP_HOME}/.venv/
# COPY --from=builder /workspace/django-polls/ django-polls/
WORKDIR $APP_HOME/IIPA
# # RUN python manage.py flush --noinput
# # RUN python manage.py migrate
ENV GCP_DEV True
ENV DEBUG False
ENV LOCAL_ENV False
# RUN pip install --upgrade pip
# RUN pipenv requirements > reqsA.txt
# RUN grep -rl 'django-polls' requirements.txt | xargs sed 's/django-polls/\/django-polls/' > requirements.txt
# RUN pip install -r requirements.txt
RUN ../.venv/bin/python manage.py makemigrations
RUN ../.venv/bin/python manage.py migrate
# ENV DJANGO_SUPERUSER_EMAIL [email protected]
# ENV DJANGO_SUPERUSER_USERNAME moose
# RUN ../.venv/bin/python manage.py createsuperuser --noinput
CMD ["../.venv/bin/python", "-m", "gunicorn", "IIPA.asgi:application", "--bind" ,":8000" ,"--log-level", "debug", "--workers", "4","--timeout", "0" ,"-k", "uvicorn.workers.UvicornWorker" ,"-c", "gunicorn.conf.py"]
EXPOSE 8000