-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (44 loc) · 1.49 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
FROM python:3.9-alpine3.13
LABEL maintainer="Eric Perazzo"
ENV PYTHONUNBUFFERED 1
COPY ./requirements.txt /tmp/requirements.txt
COPY ./requirements.dev.txt /tmp/requirements.dev.txt
COPY ./app /app
WORKDIR /app
EXPOSE 8000
ARG DEV=false
RUN python -m venv /py && \
/py/bin/pip install --upgrade pip && \
apk add --update --no-cache postgresql-client && \
apk add --update --no-cache --virtual .tmp-build-deps \
build-base postgresql-dev musl-dev && \
/py/bin/pip install -r /tmp/requirements.txt && \
if [ $DEV = "true" ]; \
then /py/bin/pip install -r /tmp/requirements.dev.txt; \
fi && \
/py/bin/pip install -r /tmp/requirements.txt && \
rm -rf /tmp && \
apk del .tmp-build-deps && \
adduser \
--disabled-password \
--no-create-home \
django-user
ENV PATH="/py/bin:$PATH"
USER django-user
# Use an official Python runtime as a parent image
# FROM python:3.10-slim-buster
# # install psycopg2 dependencies
# RUN apt-get update && \
# apt-get -y install libpq-dev gcc
# # Set the working directory to /app
# WORKDIR /app
# # Copy the current directory contents into the container at /app
# COPY . /app
# # Upgrade pip
# RUN pip install --upgrade pip
# # Install any needed packages specified in requirements.txt
# RUN pip install --no-cache-dir -r requirements.txt
# # Expose port 8000 for the Django application
# EXPOSE 8000
# Set the environment variable for Django
# ENV DJANGO_SETTINGS_MODULE=myproject.settings.prod