docker restart:unless-stopped

main
andrey 2024-02-02 12:58:47 +00:00
parent 77464b20da
commit a5ad54b655
2 changed files with 22 additions and 23 deletions

View File

@ -1,5 +1,5 @@
# Use an official Python runtime as a parent image
FROM python:3.10
FROM python:3.11.7-slim-bookworm
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
@ -13,13 +13,11 @@ WORKDIR /app
COPY . /app
# Install any needed packages specified in requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
RUN python manage.py collectstatic --noinput
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt && python manage.py collectstatic --noinput
# Copy the startup script
COPY start.sh /app/
RUN chmod +x /app/start.sh
# COPY start.sh /app/
# RUN chmod +x /app/start.sh
# Make port 8000 available to the world outside this container
EXPOSE 8000

View File

@ -2,6 +2,7 @@ version: '3'
services:
web:
restart: unless-stopped
build: .
command: sh -c "/app/start.sh"
volumes:
@ -11,7 +12,7 @@ services:
- "${PORT}:8000"
environment:
- DEBUG=${DEBUG}
- PORT=${PORT}
- PORT=8000
volumes:
media: