-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
40 lines (30 loc) · 925 Bytes
/
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
# Pulling python image from docker hub
FROM python:3.11.5-slim-bookworm
# Set work directory
WORKDIR /app
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# ENV AGROVAR_SECRET_KEY <super secret key>
# ENV DJANGO_SUPERUSER_PASSWORD <password>
# ENV DJANGO_SUPERUSER_USERNAME <username>
# ENV DJANGO_SUPERUSER_EMAIL <email>
# Install service dependencies
RUN pip install --upgrade pip
COPY ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy proyect
COPY . .
# Set workdir directory
WORKDIR /app
# Run migrations
RUN python manage.py migrate
RUN python manage.py migrate repository
# Run collect statics
RUN python manage.py collectstatic --no-input
# Create superuser
RUN python manage.py createsuperuser --noinput
# Expose
EXPOSE 8000
# Define the container entrypoint
ENTRYPOINT [ "python", "manage.py", "runserver", "0.0.0.0:8000" ]