Skip to content

Instantly share code, notes, and snippets.

@arturataide
Created September 1, 2020 23:12
Show Gist options
  • Select an option

  • Save arturataide/3b1d2c04e5cb1254969e539e710de338 to your computer and use it in GitHub Desktop.

Select an option

Save arturataide/3b1d2c04e5cb1254969e539e710de338 to your computer and use it in GitHub Desktop.
Dockerfile content
FROM python:3.8-slim-buster
RUN apt-get clean && \
apt-get update && \
apt-get install -y nginx smbclient default-libmysqlclient-dev \
gcc python3-cffi libcairo2 libpango-1.0-0 libpangocairo-1.0-0 \
libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN mkdir /PROJECT_FOLDER
WORKDIR /PROJECT_FOLDER
ADD . /PROJECT_FOLDER/
# only add this next one if yoi have static files
RUN mkdir static
RUN pip install -r requirements/requirements.txt
RUN python manage.py collectstatic
# only if you need celery
RUN useradd -ms /bin/bash celery
COPY broker/init.d_celeryd /etc/init.d/celeryd
COPY broker/celeryd /etc/default/celeryd
# nginx config and script to be run
COPY docker/nginx.conf /etc/nginx/sites-available/default
COPY docker/start.sh /usr/local/bin/start.sh
# set proper file permissions
RUN chmod u+x /etc/init.d/celeryd && \
chmod u+x /etc/default/celeryd && \
chmod u+x /usr/local/bin/start.sh
EXPOSE 80
CMD ["/bin/bash", "-c", "start.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment