Repostiory for Docker image built with Apache, Anaconda & Django.
./build_docker.sh
Assume we have a directory called public
containing HTML & JS content say from an Angular app.
Assume we have a directory called webapp
containing a Django app to serve dynamic API requests.
We can start a container called my-webapp as such:
docker run --rm -i -d --name my-webapp -p 8090:80 -v "$PWD":/app arunsworld/django-apache:Anaconda3-5.2.0
docker cp 000-default.conf my-webapp:/etc/apache2/sites-available/
docker exec my-webapp apachectl restart
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /app/public
<Directory "/app/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Alias /api /app/webapp/public
<Location /api>
PassengerBaseURI /api
PassengerAppRoot /app/webapp
PassengerAppType wsgi
PassengerStartupFile passenger_wsgi.py
</Location>
<Directory /app/webapp/public>
Allow from all
Options -MultiViews
Require all granted
</Directory>
ErrorLog /dev/stderr
CustomLog /dev/stdout combined
</VirtualHost>
docker exec my-webapp stop
.htaccess
can be configured to redirect Angular path URLs to the main index page. CORS headers may also be set if required.
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
RewriteRule ^ /channel_org/index.html
Header set Access-Control-Allow-Origin "*"