aboutsummaryrefslogtreecommitdiffstats
path: root/docker/app/Dockerfile
blob: c91c013a316bd3ed99c47107e89cb55acf64756a (plain) (blame)
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
FROM bitnami/python:3.7-prod

# I have no idea what this does.
STOPSIGNAL SIGQUIT
ARG EXTRAS=deploy

# Create a user.
RUN adduser \
    --disabled-login \
    --no-create-home \
    --uid 1500 \
    pysite

# Install prerequisites needed to complete the dependency installation.
RUN apt-get update -y \
    && \
        apt-get install --no-install-recommends -y \
                gcc \
                libc-dev \
                libpq-dev \
                git \
    && \
        apt-get clean \
    && \
        rm -rf /var/lib/apt/lists/*

# Set up the working directory.
WORKDIR /app
COPY Pipfile Pipfile.lock /app/

# Pip install the stuff we'll need.
RUN rm -r /opt/bitnami/python/lib/python3.*/site-packages/setuptools* && \
    pip install --no-cache-dir -U setuptools
RUN python3 -m pip install pipenv \
    && python3 -m pipenv install --system --deploy \
    && pip install uwsgi==2.0.18

# Copy everything into the docker environment.
COPY . .

# RUN SECRET_KEY=placeholder DATABASE_URL=sqlite:// python3 manage.py collectstatic --no-input --clear --verbosity 0

# Remove the prerequisites, dependency installation is now complete.
RUN apt-get purge -y \
            gcc \
            libc-dev \
            libpq-dev

# Migrate, collect and start the app.
RUN chmod +x /docker/app/scripts/migrate.sh
ENTRYPOINT ["/docker/app/scripts/migrate.sh"]
CMD ["uwsgi", "--ini", "docker/app/uwsgi.ini"]