summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhyang <hyang@hyang.xyz>2023-09-10 15:51:01 -0700
committerhyang <hyang@hyang.xyz>2023-09-10 15:51:01 -0700
commit66cc87ca28f7325f5df2fd264127a3f5217b304c (patch)
treef58e5ea8afcf7a323a69fbddeaba802f6d16629d
parentd4309c6d1ade94c673c0cbfc56bf8bfb99157eda (diff)
rework docker
-rw-r--r--Dockerfile5
-rwxr-xr-x[-rw-r--r--]nginx-entrypoint.sh (renamed from docker-entrypoint.sh)11
-rwxr-xr-xwatch.sh5
3 files changed, 9 insertions, 12 deletions
diff --git a/Dockerfile b/Dockerfile
index 223dccc..fce349d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,6 +4,9 @@ RUN apk add --no-cache hugo git nginx openssh
WORKDIR /app
+COPY ./watch.sh /
+COPY ./nginx-entrypoint.sh /
+
EXPOSE 8080/tcp
-CMD git clone "$REPO" ./ && /bin/sh -c './watch.sh' && hugo && nginx -g 'daemon off;'
+ENTRYPOINT git clone "$REPO" . && git submodule update --init && /bin/sh -c '/watch.sh &' ls && hugo && /nginx-entrypoint.sh && nginx -g 'daemon off;'
diff --git a/docker-entrypoint.sh b/nginx-entrypoint.sh
index 690fb49..b7fadba 100644..100755
--- a/docker-entrypoint.sh
+++ b/nginx-entrypoint.sh
@@ -1,5 +1,6 @@
mkdir -p /var/www/hugo_pub
-cp -r ./public /var/www/hugo_pub
+cp -r ./public/* /var/www/hugo_pub
+chown -R root:www-data /var/www/hugo_pub
cat <<EOF > /etc/nginx/nginx.conf
user nginx;
@@ -58,14 +59,6 @@ http {
# Set the Vary HTTP header as defined in the RFC 2616. Default is 'off'.
gzip_vary on;
-
- # Helper variable for proxying websockets.
- map $http_upgrade $connection_upgrade {
- default upgrade;
- '' close;
- }
-
-
# Specifies the main log format.
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
diff --git a/watch.sh b/watch.sh
index ddf88f9..aeb2b75 100755
--- a/watch.sh
+++ b/watch.sh
@@ -1,7 +1,8 @@
#!/bin/sh
while true; do
- git fetch && git reset --hard origin
- sleep 60
+ (git fetch && git reset --hard origin) || git clone "$REPO" . && git submodule update --init
+ git submodule update --remote
+ sleep 300
done