-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-flask
46 lines (45 loc) · 1.48 KB
/
Dockerfile-flask
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
# Dockerfile-flask
FROM n0madic/alpine-gcc:8.2.0
# Install python3 and upgrade pip
RUN apk add --no-cache \
file \
imagemagick \
imagemagick-dev \
linux-headers \
uwsgi-python3 \
python3 \
python3-dev && \
python3 -m ensurepip && \
rm -r /usr/lib/python*/ensurepip && \
pip3 install --upgrade pip setuptools && \
if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \
if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \
rm -r /root/.cache
# Install image preview generator tools
ENV MAGICK_HOME=/usr
# Set an environment variable with the directory
# where we'll be running the app
ENV APP /app
# Create the directory and instruct Docker to operate
# from there from now on
RUN mkdir $APP
WORKDIR $APP
# Expose the port uWSGI will listen on
EXPOSE 5000
# Copy the requirements file in order to install
# Python dependencies
COPY requirements.txt .
# Install Python dependencies
RUN pip3 install -r requirements.txt
# We copy the rest of the codebase into the image
COPY . .
RUN mkdir assets/images/submissions || true
RUN mkdir assets/images/submissions/accepted || true
RUN mkdir assets/images/submissions/rejected || true
RUN mkdir assets/images/submissions/pending || true
RUN mkdir assets/images/composite/iterations || true
RUN mkdir assets/images/composite/original || true
RUN mkdir assets/images/backups || true
# Finally, we run uWSGI with the ini file we
# created earlier
CMD [ "uwsgi", "--ini", "app.ini" ]