Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mazgi/hugo-theme-techlog-simple.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHidenori Matsuki <dev@mazgi.com>2020-11-01 09:47:45 +0300
committerHidenori Matsuki <dev@mazgi.com>2020-11-01 09:47:45 +0300
commitc315dfe965726048001aa32ef402ec8f7c8d1457 (patch)
tree2109c6a43a2df4fd73af53c4615a5cd35238f08c
parentf8e9b7f369cefb2caf06a3fcaf8c662f8abd5032 (diff)
improve docker environment
-rw-r--r--exampleSite/.gitignore1
-rw-r--r--exampleSite/Dockerfile17
-rw-r--r--exampleSite/Dockerfile.d/hugo-static-website/Dockerfile21
-rw-r--r--exampleSite/README.md20
-rw-r--r--exampleSite/docker-compose.yml12
5 files changed, 50 insertions, 21 deletions
diff --git a/exampleSite/.gitignore b/exampleSite/.gitignore
index d76897d..34adc88 100644
--- a/exampleSite/.gitignore
+++ b/exampleSite/.gitignore
@@ -1,2 +1,3 @@
+*.env
/public/
/.firebase/
diff --git a/exampleSite/Dockerfile b/exampleSite/Dockerfile
deleted file mode 100644
index 099c669..0000000
--- a/exampleSite/Dockerfile
+++ /dev/null
@@ -1,17 +0,0 @@
-FROM ubuntu:18.04@sha256:de774a3145f7ca4f0bd144c7d4ffb2931e06634f11529653b23eba85aef8e378
-LABEL maintainer="docker@mazgi.com"
-
-ENV DOCKERBUILD_HUGO_VERSION="0.57.0"
-ENV DEBIAN_FRONTEND="noninteractive"
-
-RUN apt-get update \
- # Install packages
- && apt-get install -y --no-install-recommends apt-utils \
- && apt-get install -y --no-install-recommends ca-certificates openssh-client curl git \
- # Download and install Hugo
- && curl -LO "https://github.com/gohugoio/hugo/releases/download/v${DOCKERBUILD_HUGO_VERSION}/hugo_${DOCKERBUILD_HUGO_VERSION}_Linux-64bit.deb" \
- && dpkg -i hugo_${DOCKERBUILD_HUGO_VERSION}_Linux-64bit.deb \
- # Clean up
- && apt-get autoremove -y \
- && apt-get clean -y \
- && rm -rf /var/lib/apt/lists/*
diff --git a/exampleSite/Dockerfile.d/hugo-static-website/Dockerfile b/exampleSite/Dockerfile.d/hugo-static-website/Dockerfile
new file mode 100644
index 0000000..775cee1
--- /dev/null
+++ b/exampleSite/Dockerfile.d/hugo-static-website/Dockerfile
@@ -0,0 +1,21 @@
+FROM ghcr.io/mazgi/hugo-static-website
+
+# Set in non-interactive mode.
+ENV DEBIAN_FRONTEND=noninteractive
+
+ARG GID=0
+ARG UID=0
+ENV GID=${GID:-0}
+ENV UID=${UID:-0}
+
+RUN :\
+ # Create a user for development who has the same UID and GID as you.
+ && addgroup --gid ${GID} developer || true\
+ && adduser --disabled-password --uid ${UID} --gecos '' --gid ${GID} developer || true\
+ && echo '%users ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/grant-all-without-password-to-users\
+ && echo '%developer ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/grant-all-without-password-to-developer
+
+# Reset DEBIAN_FRONTEND to default(`dialog`).
+# If you no need `dialog`, you can set `DEBIAN_FRONTEND=readline`.
+# see also: man 7 debconf
+ENV DEBIAN_FRONTEND=
diff --git a/exampleSite/README.md b/exampleSite/README.md
new file mode 100644
index 0000000..14747a7
--- /dev/null
+++ b/exampleSite/README.md
@@ -0,0 +1,20 @@
+# hugo-theme-techlog-simple/exampleSite
+
+You should create a ".env" file as follows.
+
+```shellsession
+rm -f .env
+test $(uname -s) = 'Linux' && echo "UID=$(id -u)\nGID=$(id -g)" >> .env
+cat<<EOE >> .env
+BIND_IP_ADDR=192.168.0.1
+EOE
+```
+
+And start the container.
+
+```shellsession
+docker-compose up
+```
+
+Now you can access to the example site via follows URL.
+`http:${BIND_IP_ADDR}:1313`
diff --git a/exampleSite/docker-compose.yml b/exampleSite/docker-compose.yml
index 11669a9..e5e71a9 100644
--- a/exampleSite/docker-compose.yml
+++ b/exampleSite/docker-compose.yml
@@ -1,10 +1,14 @@
-version: '2'
+version: "3.8"
services:
website:
- build: .
+ build:
+ context: Dockerfile.d/hugo-static-website
+ args:
+ UID: ${UID:-0}
+ GID: ${GID:-0}
working_dir: /techlog-simple/exampleSite
- command: hugo server --themesDir="../.." --bind 0.0.0.0 --buildDrafts
+ command: hugo server --bind 0.0.0.0 --buildDrafts --themesDir="../.."
volumes:
- ../:/techlog-simple
ports:
- - '1313:1313'
+ - "${BIND_IP_ADDR:-127.0.0.1}:1313:1313"