2018-08-12 13:21:40 +00:00
|
|
|
# Original file from: https://github.com/appfiles/django-uwsgi-nginx
|
2018-08-10 11:44:52 +00:00
|
|
|
# Copyright 2013 Thatcher Peskens
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2019-07-27 11:58:09 +00:00
|
|
|
FROM alpine:3.10
|
2018-08-10 11:44:52 +00:00
|
|
|
|
2018-08-12 13:21:40 +00:00
|
|
|
MAINTAINER Claudio Maggioni (praticamentetilde)
|
2018-08-10 11:44:52 +00:00
|
|
|
|
2019-04-28 14:04:26 +00:00
|
|
|
RUN addgroup -S app && adduser -S -G app app
|
2018-08-10 11:44:52 +00:00
|
|
|
|
2018-08-12 13:21:40 +00:00
|
|
|
# Install required packages and remove the apt packages cache when done
|
|
|
|
RUN apk update && apk add \
|
|
|
|
uwsgi \
|
|
|
|
py3-psycopg2 \
|
|
|
|
uwsgi-python3 \
|
2018-08-10 11:44:52 +00:00
|
|
|
git \
|
|
|
|
python3 \
|
2019-07-27 12:04:44 +00:00
|
|
|
python3-dev \
|
|
|
|
gettext
|
2018-08-10 11:44:52 +00:00
|
|
|
|
2018-08-12 13:21:40 +00:00
|
|
|
# COPY requirements.txt and RUN pip install BEFORE adding the rest of your
|
|
|
|
# code, this will cause Docker's caching mechanism to prevent re-installing
|
|
|
|
# (all your) dependencies when you made a change a line or two in your app.
|
2018-08-10 11:44:52 +00:00
|
|
|
|
2018-08-12 13:21:40 +00:00
|
|
|
COPY requirements.txt /home/app/code/
|
|
|
|
RUN pip3 install -r /home/app/code/requirements.txt
|
2018-08-10 11:44:52 +00:00
|
|
|
|
|
|
|
# add (the rest of) our code
|
2018-08-12 13:21:40 +00:00
|
|
|
COPY . /home/app/code/
|
|
|
|
|
|
|
|
RUN chown -R app: /home/app
|
2018-08-10 11:44:52 +00:00
|
|
|
|
2019-04-28 14:38:17 +00:00
|
|
|
RUN sh -c "cd /home/app/code && python3 ./manage.py collectstatic --no-input"
|
2019-07-27 11:58:09 +00:00
|
|
|
RUN sh -c "cd /home/app/code && python3 ./manage.py compilemessages"
|
2019-04-28 14:04:26 +00:00
|
|
|
|
2018-08-12 13:21:40 +00:00
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["/usr/sbin/uwsgi", "--ini", "/home/app/code/uwsgi.ini", "--plugin", "python3"]
|
|
|
|
USER app
|