diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..b5fec70768fe8f01ecaf25a4c446b6591821e98b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +* +!output +!nginx.conf +!requirements.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..49871c2110f82b112bbb9b1c5c1477f24da00da6 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,28 @@ +stages: + - build_content + - build_image + +build_content: + stage: build_content + image: python:3 + script: + - pip install -r requirements.txt + - pelican content -o output -s pelicanconf.py + artifacts: + paths: + - output/ + +build_image: + stage: build_image + dependencies: + - build_content + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + variables: + IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG + script: + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG + only: + - tags diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..46df4032ad2a98ee98bb396073ca15d0dce6dc3f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM nginx:1.17 + +RUN rm /etc/nginx/conf.d/default.conf + +COPY nginx.conf /etc/nginx/conf.d/ant.sr.conf +COPY output /opt/ant.sr/html diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000000000000000000000000000000000000..4d50d1f42055d623435fcd77198ef6db6002a712 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,15 @@ +server { + listen 80; + location / { + root /opt/ant.sr/html; + error_page 404 = @files; + } + location @files { + root /opt/ant.sr/files; + error_page 404 = @urlshortener + } + location @urlshortener { + # TODO! + return 404; + } +} diff --git a/pelicanconf.py b/pelicanconf.py index 686e2496a16725448acefdc6141159faff51b1c5..75640fe0f372ea74f3173d09d590e1eaf97ff2fd 100644 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -1,11 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals +import os + AUTHOR = 'Anton Sarukhanov' SITENAME = 'Anton Sarukhanov' SITESUBTITLE = 'Full-Stack Developer' -# SITEURL = 'https://ant.sr/' +SITEURL = os.environ.get('SITEURL') PLUGINS = ['advthumbnailer'] diff --git a/requirements.txt b/requirements.txt index 70ee8c94abd9fa6d8ce503798b18b7f81b469033..93f8cfd7a792bddb9a05effd3d4aa6cfe2bc9286 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,6 @@ +wheel pelican==3.6.3 Markdown==2.6.6 pelican-advthumbnailer==0.5.0 +piexif==1.1.3 +Pillow==5.0.0