-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerFile
More file actions
65 lines (46 loc) · 1.58 KB
/
Copy pathDockerFile
File metadata and controls
65 lines (46 loc) · 1.58 KB
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
# Main DockerFile for creating the
# container for Django
# FROM python:3 AS django
FROM python:3
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
LABEL "com.example.application"="application"
# COPY start.sh /start/
# COPY ./docker/wait_for_postgres.py /start/
# RUN chmod +x ./start/start.sh
# chmod +x ./start/wait_for_postgres.py
RUN mkdir /code
WORKDIR /code
# Update Pip
RUN pip install --upgrade pip
# Install dependencies
COPY Pipfile Pipfile
COPY Pipfile.lock Pipfile.lock
RUN pip3 install pipenv
RUN pipenv install --system --deploy
# Copy the application
COPY . /code/
EXPOSE 8000
# Start project using a simple script file
# ENTRYPOINT [ "../start/start.sh" ]
# ...or one that waits for the database
# ENTRYPOINT [ "../start/wait_for_postgres.py" ]
# ...or with development server
# ENTRYPOINT [ "pipenv", "run", "python", "/code/website/mydjango/manage.py", "runserver", "0.0.0.0:8000" ]
# ...without using pipenv
ENTRYPOINT [ "python", "/code/website/mydjango/manage.py", "runserver", "0.0.0.0:8000" ]
# CMD pipenv run python manage.py runserver 0.0.0.0:8000
# ...or Gunicorn for production purposes
# CMD gunicorn mydjango.wsgi -w 4 -b 0.0.0.0:8000 --chdir=/code/website/mydjango --log-file -
# TODO: For Django projects with nested Vue app,
# we have to run a multistage build with node
# FROM django AS vue
# RUN apt-get install -y git-core curl build-essential openssl libssl-dev \
# && git clone https://github.com/nodejs/node.git \
# && cd node \
# && ./configure \
# && make \
# && sudo make install
# WORKDIR /frontend
# RUN npm install
# RUN npm run build