From fbb61ebdd163e03a5affb691e1b302270510eb55 Mon Sep 17 00:00:00 2001 From: Melora Hugues Date: Mon, 26 Jun 2023 22:45:24 +0200 Subject: [PATCH] Add Dockerfile to deploy site --- .dockerignore | 2 ++ .gitignore | 3 ++- Dockerfile | 7 +++++++ Makefile | 5 +++++ nginx/nginx.conf | 26 ++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 nginx/nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..60b2f55 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +public +.hugo_build.lock \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5e462e4..0d92c8a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ # hugo files .hugo_build.lock -**/_gen \ No newline at end of file +**/_gen +public \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..058766f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM klakegg/hugo:ext-alpine-ci as builder +COPY . /src/ +RUN hugo + +FROM nginx:1.25 as dest +COPY --from=builder /src/public /usr/share/nginx/html +COPY nginx/nginx.conf /etc/nginx/nginx.conf diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ea984b8 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +rundev: + hugo server --buildDrafts + +run: + hugo server diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..84e9af2 --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,26 @@ +# user www www; ## Default: nobody +worker_processes 1; ## Default: 1 +error_log /var/log/nginx/error.log; +pid /var/run/nginx.pid; +worker_rlimit_nofile 8192; + +events { + worker_connections 4096; ## Default: 1024 +} + +http { + include /etc/nginx/mime.types; +# include /etc/nginx/proxy.conf; +# include /etc/nginx/fastcgi.conf; + + server { + listen 80; + + server_name faercol.me www.faercol.me; + + index index.html; + root /usr/share/nginx/html/; + error_page 404 404.html; + + } +} \ No newline at end of file