|
@@ -1,32 +1,37 @@
|
|
|
-FROM python:3.11
|
|
|
|
|
-
|
|
|
|
|
-ENV APP_HOME=/app
|
|
|
|
|
-RUN mkdir -p $APP_HOME
|
|
|
|
|
-
|
|
|
|
|
-WORKDIR $APP_HOME
|
|
|
|
|
|
|
+FROM python:3.11-slim
|
|
|
|
|
|
|
|
# install system dependencies
|
|
# install system dependencies
|
|
|
-RUN apt-get update && apt-get install -y nginx sqlite3 netcat-traditional vim curl jq
|
|
|
|
|
|
|
+RUN apt-get update && apt-get install nginx netcat-openbsd curl vim jq rsync libpango-1.0-0 libpangocairo-1.0-0 libcairo2 -y
|
|
|
|
|
|
|
|
-COPY ./src/requirements.txt .
|
|
|
|
|
|
|
+# 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
|
|
|
|
|
|
|
|
-RUN pip install --upgrade pip
|
|
|
|
|
-RUN pip install --no-cache-dir --no-deps -r requirements.txt
|
|
|
|
|
|
|
+# 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
|
|
|
|
|
|
|
|
-# copia fichero de configuración de nginx
|
|
|
|
|
|
|
+# copy the django code
|
|
|
|
|
+COPY ./src ./app
|
|
|
|
|
|
|
|
-COPY ./nginx/nginx.conf /etc/nginx/
|
|
|
|
|
|
|
+# change our working directory to the django projcet roo
|
|
|
|
|
+WORKDIR /app
|
|
|
|
|
|
|
|
-# enlace los logs de nginx a stdout
|
|
|
|
|
-RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
|
|
|
|
|
|
|
+# 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
|
|
|
|
|
|
|
|
-COPY ./entrypoint.sh .
|
|
|
|
|
|
|
+# Añade path a .bashrc
|
|
|
|
|
|
|
|
-COPY . $APP_HOME
|
|
|
|
|
|
|
+RUN echo "export PATH=/opt/venv/bin/:$PATH" >> /root/.bashrc
|
|
|
|
|
|
|
|
-RUN chmod +x /app/entrypoint.sh
|
|
|
|
|
|
|
+# make our entrypoint.sh executable
|
|
|
|
|
+RUN chmod +x config/entrypoint.sh
|
|
|
|
|
|
|
|
-WORKDIR $APP_HOME/src
|
|
|
|
|
|
|
+#EXPOSE 8080
|
|
|
|
|
|
|
|
-# run entrypoint.sh
|
|
|
|
|
-ENTRYPOINT ["/app/entrypoint.sh"]
|
|
|
|
|
|
|
+# execute our entrypoint.sh file
|
|
|
|
|
+CMD ["./config/entrypoint.sh"]
|