generated from n1rjal/djate
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
41 lines (30 loc) · 986 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
41
# Specify the platform as an argument
ARG PLATFORM=linux/arm64
# Base image with specified platform
FROM --platform=$PLATFORM python:3.11-slim AS base
# Create a non-root user and group
RUN groupadd -r gnome_group && useradd -r -g gnome_group -d /app -s /bin/bash gnome_user
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
pkg-config build-essential libpq-dev ca-certificates \
&& pip install --no-cache-dir --upgrade pip \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir --no-compile -r requirements.txt
COPY . .
RUN chmod +x Makefile
# make empty directory for logs and media
RUN mkdir logs media
RUN chown -R gnome_user:gnome_group /app
USER gnome_user
FROM base AS worker
FROM base AS development
EXPOSE 8000
CMD ["make", "dev"]
FROM base AS production
EXPOSE 8000
CMD ["make", "prod"]