Fakultas Ilmu Komputer UI

Commit d8cbe861 authored by Farhan Azyumardhi Azmi's avatar Farhan Azyumardhi Azmi
Browse files

[CHORES] Add Dockerfile and compose file

parent 714a77db
Pipeline #59353 passed with stages
in 15 minutes and 16 seconds
# BUILDER
FROM python:3.7-slim as builder
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install --no-install-recommends gcc python3-dev libpq-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
COPY . .
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt
# FINAL
FROM python:3.7-slim
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install --no-install-recommends gcc python3-dev libpq-dev
RUN mkdir -p /home/digipus
ENV APP_HOME=/home/digipus/
RUN mkdir $APP_HOME/staticfiles
RUN mkdir $APP_HOME/mediafiles
WORKDIR $APP_HOME
COPY . .
COPY --from=builder /usr/src/app/wheels /wheels
COPY --from=builder /usr/src/app/requirements.txt .
RUN pip install --no-cache /wheels/*
EXPOSE 8000
VOLUME ["/home/digipus/staticfiles", "/home/digipus/mediafiles"]
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "digipus.wsgi:application", "--reload"]
version: "3.7"
services:
digipus:
build: .
env_file:
- .env
ports:
- 8000:8000
depends_on:
- db
db:
image: postgres:12
volumes:
- postgres_data:/var/lib/postgresql/data/
- static_volume:/home/digipus/staticfiles
- media_volume:/home/digipus/mediafiles
env_file:
- .env.db
volumes:
postgres_data:
static_volume:
media_volume:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment