Second try
This commit is contained in:
44
Dockerfile
44
Dockerfile
@@ -1,47 +1,33 @@
|
|||||||
FROM python:3.8.1-slim-buster
|
FROM python:3.8.1-slim-buster
|
||||||
|
|
||||||
RUN useradd wagtail
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
# Set working directory
|
# Install system dependencies
|
||||||
WORKDIR /app
|
RUN apt-get update --yes && apt-get install --yes --no-install-recommends \
|
||||||
|
|
||||||
# Set environment variables
|
|
||||||
ENV PYTHONUNBUFFERED=1 \
|
|
||||||
PORT=8000
|
|
||||||
|
|
||||||
# Install system packages required by Wagtail and Django
|
|
||||||
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
|
|
||||||
build-essential \
|
build-essential \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
libmariadbclient-dev \
|
|
||||||
libjpeg62-turbo-dev \
|
libjpeg62-turbo-dev \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
libwebp-dev \
|
libwebp-dev \
|
||||||
|
gettext \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Upgrade pip to the latest version
|
# Add and set up the working directory
|
||||||
RUN pip install --upgrade pip
|
WORKDIR /app
|
||||||
|
|
||||||
# Install the application server
|
# Copy requirements file and install dependencies
|
||||||
RUN pip install "gunicorn==20.0.4"
|
COPY requirements.txt /app/
|
||||||
|
RUN pip install --upgrade pip \
|
||||||
|
&& pip install -r /app/requirements.txt
|
||||||
|
|
||||||
COPY requirements.txt /app/requirements.txt
|
# Copy application code
|
||||||
RUN pip install -r /app/requirements.txt
|
COPY . /app/
|
||||||
|
|
||||||
# Copy the source code of the project into the container
|
|
||||||
COPY --chown=wagtail:wagtail . .
|
|
||||||
|
|
||||||
# Set this directory to be owned by the "wagtail" user
|
|
||||||
RUN chown wagtail:wagtail /app
|
|
||||||
|
|
||||||
# Use user "wagtail" to run the build commands below and the server itself
|
|
||||||
USER wagtail
|
|
||||||
|
|
||||||
# Collect static files
|
# Collect static files
|
||||||
RUN python manage.py collectstatic --noinput --clear
|
RUN python manage.py collectstatic --noinput --clear
|
||||||
|
|
||||||
# Port used by this container to serve HTTP
|
# Expose the port the app runs on
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# Runtime command that executes when "docker run" is called
|
# Run the application server
|
||||||
CMD ["sh", "-c", "python manage.py migrate --noinput && gunicorn saburly.wsgi:application"]
|
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "saburly.wsgi:application"]
|
||||||
Reference in New Issue
Block a user