From 0d4df54f7e9db24c45e2c4673ece5f39d631bbff Mon Sep 17 00:00:00 2001 From: Blair V Date: Fri, 17 Sep 2021 15:29:10 +0300 Subject: [PATCH] docker build --- .gitignore | 1 + Dockerfile | 19 +++++++++++++++++++ README.md | 2 -- nginx.conf | 25 +++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.gitignore b/.gitignore index 29bb994..9e1d9de 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ __pycache__ *.o output/ node_modules/ +.venv/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1446540 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.9.7-slim-buster as build + +WORKDIR /app + +RUN apt-get update && apt-get install make + +COPY requirements.txt . + +RUN pip install -r requirements.txt + +COPY . . + +RUN make publish + +FROM openresty/openresty:buster-fat + +COPY --from=build /app/output /var/www/pelican/output/ + +COPY nginx.conf /etc/nginx/conf.d/default.conf diff --git a/README.md b/README.md index 389ef76..2b563b1 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,6 @@ A static website built with pelican. ## INSTRUCTIONS ON HOW TO BUILD ```angular2html -git clone git@gitlab.com:grassrootseconomics/pelican-website-ge.git -git checkout Ida/pelican python3 -m venv env source env/bin/activate pip install -r requirements.txt diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..41187e9 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,25 @@ +server { + listen [::]:80; + listen 80; + + server_name localhost; + root /var/www/pelican/output; + + location = / { + rewrite ^ /index.html; + } + + location / { + gzip_static on; + try_files $uri.htm $uri.html $uri =404; + } + + location = /favicon.ico { + expires max; + } + + location ^~ /theme { + expires 1y; + } + +}