diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..555fbad --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM docker.io/hugomods/hugo:debian-exts AS builder + +WORKDIR /src +COPY . . +RUN hugo --minify + +FROM docker.io/nginx:alpine +COPY --from=builder /src/public /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 + + diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 0000000..18c775f --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,16 @@ +version: '3' +services: + blog: + build: . + restart: always + networks: + - web + labels: + - "traefik.enable=true" + - "traefik.http.routers.blog.rule=Host(`blog.yourdomain.com`)" + - "traefik.http.routers.blog.entrypoints=websecure" + - "traefik.http.routers.blog.tls.certresolver=myresolver" + +networks: + web: + external: true \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4cb901b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' +services: + hugo: + image: docker.io/hugomods/hugo:debian-exts + command: server -D --bind 0.0.0.0 + volumes: + - .:/src + ports: + - "1313:1313" + \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..a551172 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,10 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + + location / { + index index.html; + try_files $uri $uri/ =404; + } +}