/Dockerfile Secret
Last active
July 31, 2022 22:42
host dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dockerfile for Django Applications | |
# Section 1- Base Image | |
FROM python:3.8-slim | |
# Section 2- Python Interpreter Flags | |
ENV PYTHONUNBUFFERED 1 | |
ENV PYTHONDONTWRITEBYTECODE 1 | |
# create directory for the app user | |
RUN mkdir -p /home/app | |
# create the appropriate directories | |
ENV HOME=/home/app | |
ENV APP_HOME=/home/app/web | |
RUN mkdir $APP_HOME | |
RUN mkdir $APP_HOME/static | |
RUN mkdir $APP_HOME/media | |
# copy project | |
COPY . $APP_HOME | |
RUN ls | |
# Section 3- Compiler and OS libraries | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends build-essential libpq-dev \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Section 4- Project libraries and User Creation | |
#COPY requirements.txt /tmp/requirements.txt | |
RUN pip install --no-cache-dir -r "$APP_HOME/container_config/web/requirements.txt" \ | |
&& useradd -U app_user \ | |
&& install -d -m 0755 -o app_user -g app_user $APP_HOME/static | |
# Section 5- Code and User Setup | |
#WORKDIR /app | |
USER root | |
WORKDIR $APP_HOME | |
RUN chown -R app_user:app_user $APP_HOME | |
USER app_user:app_user | |
#COPY --chown=app_user:app_user . . | |
#RUN chmod +x docker/*.sh | |
# Section 6- Docker Run Checks and Configurations | |
#ENTRYPOINT [ "docker/entrypoint.sh" ] | |
# | |
#CMD [ "docker/start.sh", "server" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment