-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·46 lines (26 loc) · 1.34 KB
/
Dockerfile
File metadata and controls
executable file
·46 lines (26 loc) · 1.34 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
FROM python:3.10
#FROM python:3.10-slim
#install nano text editor in docker container
RUN apt-get update -y && apt-get install nano -y && apt-get install nginx -y && apt-get install -y gunicorn systemd && apt-get install net-tools && apt-get install libmariadb-dev-compat libmariadb-dev
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Create directory and sub-directory for project
RUN mkdir -p /app/project-blog/
# set work directory
WORKDIR /app/project-blog/
# install dependencies
RUN pip install --upgrade pip && pip install virtualenv
# Create a virtual environment
RUN virtualenv /app/project-blog/venv
# Set the Python interpreter to the venv's interpreter
ENV PATH="/app/project-blog/venv/bin:$PATH"
ADD . /app/project-blog/
# set work directory
WORKDIR /app/project-blog/blog/
RUN pip install -r requirements.txt
# Create service for gunicorn server. it is possible to start server without create service but we will start, restart and stop gunicorn server using system service.
# RUN cp /app/project-blog/blog/docker/gunicorn/gunicorn.service /etc/systemd/ && cp /app/project-blog/blog/docker/gunicorn/gunicorn.socket /etc/systemd/
#RUN systemctl start gunicorn.socket && systemctl enable gunicorn.socket
RUN chmod +x /app/project-blog/blog/docker/backend/entry-point/server-entrypoint.sh
EXPOSE 8000