Skip to content

Commit

Permalink
Dockerfile fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
faizan35 committed Nov 27, 2023
1 parent 2ed892c commit 31a99ac
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
# Stage 1: Build the Flask Application
# ------------------- Stage 1: Build Stage ------------------------
FROM python:3.9 AS backend-builder

# Set the working directory to /app
WORKDIR /app

COPY backend/requirements.txt ./
# Copy the contents of the backend directory into the container at /app
COPY backend/ .

# Install dependencies specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

COPY backend/ .
# ------------------- Stage 2: Final Stage ------------------------

# Stage 2: Final Image
FROM python:3.9-slim-buster
# Use a slim Python 3.9 image as the final base image
FROM python:3.9-slim

# Set the working directory to /app
WORKDIR /app

# Copy the built dependencies from the backend-builder stage
COPY --from=backend-builder /usr/local/lib/python3.9/site-packages/ /usr/local/lib/python3.9/site-packages/

# Copy the application code from the backend-builder stage
COPY --from=backend-builder /app /app

# Expose port 5000 for the Flask application
EXPOSE 5000

# Define the default command to run the application
CMD ["python", "app.py"]

0 comments on commit 31a99ac

Please sign in to comment.