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