You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
1.0 KiB

# yup, python 3.11!
FROM python:3.11-slim
USER 0
# install nginx
RUN apt-get update && apt-get install nginx -y
# copy our nginx configuration to overwrite nginx defaults
RUN rm /etc/nginx/sites-enabled/default
RUN rm /etc/nginx/sites-available/default
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
# link nginx logs to container stdout
RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
# copy the django code
COPY ./src ./app
RUN chgrp -R 0 ./app && chmod -R g=u ./app
RUN chgrp -R 0 /var/lib/nginx && chmod -R g=u /var/lib/nginx
# change our working directory to the django projcet roo
WORKDIR /app
# create virtual env (notice the location?)
# update pip
# install requirements
RUN python -m venv /opt/venv && \
/opt/venv/bin/python -m pip install pip --upgrade && \
/opt/venv/bin/python -m pip install -r requirements.txt
# make our entrypoint.sh executable
RUN chmod +x config/entrypoint.sh
RUN chmod u+s /usr/sbin/nginx
# execute our entrypoint.sh file
CMD ["./config/entrypoint.sh"]