-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
30 lines (23 loc) · 879 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
FROM ubuntu:22.04
# Install Python3, Apache, and mod_wsgi
RUN apt-get update && \
apt-get install -y \
python3 \
python3-pip \
python3-venv \
apache2 \
libapache2-mod-wsgi-py3 && \
apt-get clean
# Activate the mod_wsgi
RUN a2enmod wsgi
# Add the apache VirtualHost, to setup the WSGI module for the app
COPY apache-vhost.conf /etc/apache2/sites-enabled/000-default.conf
# Optional: Redirect error log to stdout, to make it visible in `docker compose up` output
RUN ln -sf /dev/stdout /var/log/apache2/error.log
# Install FastAPI and the WSGIMiddleware
RUN python3 -m venv /var/www/html/.venv && \
/var/www/html/.venv/bin/python3 -m pip install fastapi a2wsgi
# Add the FastAPI application
COPY main.py /var/www/html/
RUN chown -R www-data:www-data /var/www/html
CMD ["apachectl", "-D", "FOREGROUND"]