diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..0a4679a --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,40 @@ +name: deploy + +on: + push: + branches: [ main ] + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Install docker + run: apt update && apt install -y docker.io + + - name: Checkout + uses: https://github.com/actions/checkout@v3 + + - name: Set up QEMU + uses: https://github.com/docker/setup-qemu-action@v3 + with: + platforms: amd64 + + - name: Set up Docker Buildx + uses: https://github.com/docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: https://github.com/docker/login-action@v3 + with: + registry: gitea.mrdev023.fr + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + + - name: Build and push + uses: https://github.com/docker/build-push-action@v5 + with: + context: . + build-args: + NGINX_VERSION: 1.27.2 + file: ./docker/Dockerfile + push: false + tags: gitea.mrdev023.fr/florian.richer/portfolio:latest \ No newline at end of file diff --git a/config/_default/params.yml b/config/_default/params.yml index 699b2ab..8a54015 100644 --- a/config/_default/params.yml +++ b/config/_default/params.yml @@ -14,7 +14,6 @@ article: default: Licensed under CC BY-NC-SA 4.0 sidebar: - emoji: "🍥" subtitle: Développeur d´application Web et Mobile. avatar: diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..6ae6d17 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,21 @@ +ARG NGINX_VERSION= + +##################################################################### +# Build Stage # +##################################################################### +FROM docker.io/hugomods/hugo:exts as builder + +COPY . /src + +RUN hugo --minify --enableGitInfo + +##################################################################### +# Final Stage # +##################################################################### +FROM docker.io/nginx:${NGINX_VERSION}-alpine-slim as runner + +COPY docker/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf + +COPY --from=builder /src/public /site + +EXPOSE 8080 diff --git a/docker/nginx/conf.d/default.conf b/docker/nginx/conf.d/default.conf new file mode 100644 index 0000000..f46949b --- /dev/null +++ b/docker/nginx/conf.d/default.conf @@ -0,0 +1,36 @@ +server { + listen 8080; + listen [::]:8080; + server_name localhost; + + gzip on; + gzip_comp_level 9; + gzip_types + text/html + text/plain + text/css + text/js + text/xml + text/javascript + application/javascript + application/json + application/xml + application/rss+xml + image/svg+xml; + + root /site; + + location / { + index index.html index.htm; + } + + location ~* ^/([^/]+) { + index index.html index.htm; + error_page 404 = @error; + } + + error_page 404 /404.html; + location @error { + try_files /$1/404.html /404.html =404; + } +} \ No newline at end of file