fix(deploy): Clean up & fix generated Docker setup

- Remove `ffmpeg` from `apt-get install` step
- Fix and deduplicate `COPY` statements: exclude irrelevant files and optimize for caching
- Add `DATABASE_URL` to `app` service in `docker-compose.yml`
This commit is contained in:
Reinier van der Leer committed 2024-03-18 18:32:18 +01:00
1 parent 61e263cb9e
commit bb43387320
1 file changed
+12 -10
+12 -10
View File
@@ -27,22 +27,23 @@ WORKDIR /app
# Install system dependencies
RUN apt-get update \\
&& apt-get install -y build-essential curl ffmpeg \\
&& apt-get install -y build-essential curl \\
&& apt-get clean \\
&& rm -rf /var/lib/apt/lists/*
# Copy only requirements to cache them in Docker layer
WORKDIR /app
COPY . /app
# Project initialization:
# Install dependencies
COPY requirements.txt /app
RUN pip install -r requirements.txt
# Generate Prisma client
RUN prisma generate
COPY . /app
# Set a default value (this can be overridden)
# Add application source
COPY project/ /app/project/
# Set a default port (this can be overridden)
ENV PORT=8000
# This will be the command to run the FastAPI server using uvicorn
@@ -213,9 +214,10 @@ services:
context: .
dockerfile: Dockerfile
environment:
- PORT=8080
DATABASE_URL: ${DATABASE_URL}
PORT: 8080
ports:
- "8080:8080"
- "8080:8080"
"""
return docker_compose