Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 35 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,51 @@
FROM python:3.8-alpine
FROM python:3.11-alpine AS builder

RUN mkdir /app
WORKDIR /app

RUN apk add --update \

RUN apk add --no-cache \
build-base \
jpeg-dev \
zlib-dev \
postgresql-dev \
gettext \
bash \
zip \
unzip \
git \
nano \
vim
gcc \
musl-dev \
python3-dev

ENV LIBRARY_PATH=/lib:/usr/lib
COPY requirements.txt .

ENV PYTHONUNBUFFERED 1
ENV DJANGO_SETTINGS_MODULE website.settings.docker

COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir gunicorn && \
pip wheel --no-cache-dir --no-deps --wheel-dir /app/wheels -r requirements.txt


FROM python:3.11-alpine

WORKDIR /app


RUN apk add --no-cache \
libpq \
jpeg-dev \
zlib-dev \
gettext \
bash


COPY --from=builder /app/wheels /wheels
COPY --from=builder /app/requirements.txt .
RUN pip install --no-cache /wheels/*

RUN pip install -r requirements.txt && \
pip install gunicorn

COPY . .


RUN git clone https://github.com/metucclub/docker-scripts && \
mv docker-scripts/*.sh . && \
rm -rf docker-scripts && \
mkdir -p ./db
mv docker-scripts/*.sh . && \
rm -rf docker-scripts && \
mkdir -p ./db && \
chmod a+x *.sh

RUN chmod a+x backup-data.sh restore-data.sh docker-wait-for-it.sh
ENV PYTHONUNBUFFERED 1
ENV DJANGO_SETTINGS_MODULE website.settings.docker