-
Notifications
You must be signed in to change notification settings - Fork 0
/
_Dockerfile
47 lines (36 loc) · 1.53 KB
/
_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
42
43
44
45
46
# Docker not yet implemented
# Use an official Python runtime as a parent image
FROM python:3.12-slim
# Set environment variables to prevent Python from writing pyc files to disc
# and buffering stdout and stderr (useful for logging)
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set the working directory in the container
WORKDIR /app
# Install system dependencies for MySQL and Chrome (optional for headless browser testing)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
default-libmysqlclient-dev \
build-essential \
wget \
gnupg2 && \
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list' && \
apt-get update && \
apt-get install -y --no-install-recommends \
google-chrome-stable \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install ChromeDriver
RUN wget -O /usr/local/bin/chromedriver http://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip && \
chmod +x /usr/local/bin/chromedriver
# Copy the current directory contents into the container at /app
COPY . /app
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r ling508/requirements.txt
# Make port 5000 available to the world outside this container
EXPOSE 5000
# Define environment variable for Flask
ENV FLASK_ENV=production
# Run the application
CMD ["python", "ling508/api.py"]