-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathDockerfile
41 lines (30 loc) · 810 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Dockerfile
FROM python:3.11-slim AS base
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV FLASK_SECRET_KEY='M!technicalmod-test2024'
# Install git
RUN apt-get update && \
apt-get install -y git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy the requirements file and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . .
# Ensure the .git directory is copied
COPY .git .git
# Expose the port the app runs on
EXPOSE 3000
# Build stage for testing
FROM base AS test
# Run unit tests
RUN python -m unittest discover -s tests
# Final stage
FROM base AS final
# Run the application
CMD ["python", "app.py"]