48 lines
1.6 KiB
Docker
48 lines
1.6 KiB
Docker
# Original file from: https://github.com/appfiles/django-uwsgi-nginx
|
|
# 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.
|
|
|
|
FROM alpine:3.10
|
|
|
|
MAINTAINER Claudio Maggioni (praticamentetilde)
|
|
|
|
RUN addgroup -S app && adduser -S -G app app
|
|
|
|
# Install required packages and remove the apt packages cache when done
|
|
RUN apk update && apk add \
|
|
uwsgi \
|
|
py3-psycopg2 \
|
|
uwsgi-python3 \
|
|
git \
|
|
python3 \
|
|
python3-dev
|
|
|
|
# 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.
|
|
|
|
COPY requirements.txt /home/app/code/
|
|
RUN pip3 install -r /home/app/code/requirements.txt
|
|
|
|
# add (the rest of) our code
|
|
COPY . /home/app/code/
|
|
|
|
RUN chown -R app: /home/app
|
|
|
|
RUN sh -c "cd /home/app/code && python3 ./manage.py collectstatic --no-input"
|
|
RUN sh -c "cd /home/app/code && python3 ./manage.py compilemessages"
|
|
|
|
EXPOSE 8000
|
|
CMD ["/usr/sbin/uwsgi", "--ini", "/home/app/code/uwsgi.ini", "--plugin", "python3"]
|
|
USER app
|