From e9ad37976098178fd5f6718fb5db7ede679a1de3 Mon Sep 17 00:00:00 2001 From: Gatsby Lee Date: Thu, 28 Dec 2023 21:17:34 -0800 Subject: [PATCH 1/9] Update Dockerfile.onbuild * update node version * remove maintainer --- Dockerfile.onbuild | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.onbuild b/Dockerfile.onbuild index 3a5057f..eb3d049 100644 --- a/Dockerfile.onbuild +++ b/Dockerfile.onbuild @@ -1,5 +1,5 @@ -FROM node:12-buster -MAINTAINER José Moreira +FROM node:20-buster + RUN yarn global add gatsby-cli ONBUILD WORKDIR /app ONBUILD ADD . ./ From e4bb4b9dcfba213a7e071e68b0867f744808360d Mon Sep 17 00:00:00 2001 From: Gatsby Lee Date: Thu, 28 Dec 2023 21:18:02 -0800 Subject: [PATCH 2/9] Update Dockerfile removed maintainer in dockerfile --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2ba18d2..17a515f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ FROM alpine:edge -MAINTAINER José Moreira COPY nginx-boot.sh /sbin/nginx-boot RUN chmod +x /sbin/nginx-boot From 65a4b6c8bd4d36fae01c960519605c52aaf8765e Mon Sep 17 00:00:00 2001 From: Gatsby Lee Date: Fri, 29 Dec 2023 01:10:40 -0800 Subject: [PATCH 3/9] add webp into CACHE_PUBLIC --- nginx-boot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx-boot.sh b/nginx-boot.sh index 9e568bd..9e3dbad 100755 --- a/nginx-boot.sh +++ b/nginx-boot.sh @@ -13,7 +13,7 @@ export GZIP_TYPES=${GZIP_TYPES:-application/javascript application/x-javascript export GZIP_LEVEL=${GZIP_LEVEL:-6} export CACHE_IGNORE=${CACHE_IGNORE:-html} -export CACHE_PUBLIC=${CACHE_PUBLIC:-ico|jpg|jpeg|png|gif|svg|js|jsx|css|less|swf|eot|ttf|otf|woff|woff2} +export CACHE_PUBLIC=${CACHE_PUBLIC:-ico|jpg|jpeg|png|gif|svg|webp|js|jsx|css|less|swf|eot|ttf|otf|woff|woff2} export CACHE_PUBLIC_EXPIRATION=${CACHE_PUBLIC_EXPIRATION:-1y} if [ "$TRAILING_SLASH" = false ]; then From 3b9412f15a4f7070bc4b13d9b778a6d882a072ff Mon Sep 17 00:00:00 2001 From: Gatsby Lee Date: Fri, 29 Dec 2023 01:12:38 -0800 Subject: [PATCH 4/9] add avif into CACHE_PUBLIC --- nginx-boot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx-boot.sh b/nginx-boot.sh index 9e3dbad..8f56db7 100755 --- a/nginx-boot.sh +++ b/nginx-boot.sh @@ -13,7 +13,7 @@ export GZIP_TYPES=${GZIP_TYPES:-application/javascript application/x-javascript export GZIP_LEVEL=${GZIP_LEVEL:-6} export CACHE_IGNORE=${CACHE_IGNORE:-html} -export CACHE_PUBLIC=${CACHE_PUBLIC:-ico|jpg|jpeg|png|gif|svg|webp|js|jsx|css|less|swf|eot|ttf|otf|woff|woff2} +export CACHE_PUBLIC=${CACHE_PUBLIC:-avif|gif|ico|jpg|jpeg|png|svg|webp|js|jsx|css|less|swf|eot|ttf|otf|woff|woff2} export CACHE_PUBLIC_EXPIRATION=${CACHE_PUBLIC_EXPIRATION:-1y} if [ "$TRAILING_SLASH" = false ]; then From c13143612df8db09739c5b2bf5b313ef60fbe652 Mon Sep 17 00:00:00 2001 From: Gatsby Lee Date: Fri, 29 Dec 2023 01:27:02 -0800 Subject: [PATCH 5/9] update CLIENT_MAX_BODY_SIZE configurable --- nginx-boot.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nginx-boot.sh b/nginx-boot.sh index 8f56db7..d5c87a9 100755 --- a/nginx-boot.sh +++ b/nginx-boot.sh @@ -16,6 +16,8 @@ export CACHE_IGNORE=${CACHE_IGNORE:-html} export CACHE_PUBLIC=${CACHE_PUBLIC:-avif|gif|ico|jpg|jpeg|png|svg|webp|js|jsx|css|less|swf|eot|ttf|otf|woff|woff2} export CACHE_PUBLIC_EXPIRATION=${CACHE_PUBLIC_EXPIRATION:-1y} +export CLIENT_MAX_BODY_SIZE=${CLIENT_MAX_BODY_SIZE:-64k} + if [ "$TRAILING_SLASH" = false ]; then REWRITE_RULE="rewrite ^(.+)/+\$ \$1 permanent" TRY_FILES="try_files \$uri \$uri/index.html =404" @@ -64,7 +66,7 @@ http { tcp_nopush on; tcp_nodelay on; - client_max_body_size 64k; + client_max_body_size $CLIENT_MAX_BODY_SIZE; client_header_buffer_size 16k; large_client_header_buffers 4 16k; From 9636b6b885aa45c0356b64671f263dd63888006c Mon Sep 17 00:00:00 2001 From: Gatsby Lee Date: Fri, 29 Dec 2023 01:31:32 -0800 Subject: [PATCH 6/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ac5af75..8dd8815 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# gatsbyjs/gatsby-docker [![Travis CI Build Status](https://travis-ci.org/gatsbyjs/gatsby-docker.svg?branch=master)](https://travis-ci.org/gatsbyjs/gatsby-docker) +# gatsbyjs/gatsby-docker Docker image that builds and hosts a Gatsby site. *Note: this is a community maintained project and doesn't yet have support for Gatsby v3 and beyond features like Functions, SSR, and DSG* From 46bf48b7645e3a49f47420f4dc8cce46c1d90499 Mon Sep 17 00:00:00 2001 From: Gatsby Lee Date: Fri, 29 Dec 2023 01:35:48 -0800 Subject: [PATCH 7/9] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8dd8815..bb8f765 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Below is the complete list of available options that can be used to customize yo | Environment variable | Default | Description | |---------------------------|--------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `CACHE_IGNORE` | `html` | Regular expression to specify which paths shouldn't be cacheable (header `Cache-Control` set to `no-store`). | -| `CACHE_PUBLIC` | `ico\|jpg\|jpeg\|png\|gif\|svg\|js\|jsx\|css\|less\|swf\|eot\|ttf\|otf\|woff\|woff2` | Regular expression to specify which paths should be cacheable (headers `Cache-Control` set to `public` and `Expires` set to the value of `$CACHE_PUBLIC_EXPIRATION`). | +| `CACHE_PUBLIC` | `avif\|gif\|ico\|jpg\|jpeg\|png\|svg\|webp\|js\|jsx\|css\|less\|swf\|eot\|ttf\|otf\|woff\|woff2` | Regular expression to specify which paths should be cacheable (headers `Cache-Control` set to `public` and `Expires` set to the value of `$CACHE_PUBLIC_EXPIRATION`). | | `CACHE_PUBLIC_EXPIRATION` | `1y` | Time to set for header `Expires`. See http://nginx.org/en/docs/http/ngx_http_headers_module.html#expires | | `CHARSET` | `utf-8` | Charset being used in `Content-Type` response header field. See http://nginx.org/en/docs/http/ngx_http_charset_module.html | | `CUSTOM_SERVER_CONFIG` | ` ` | Need to add some advanced/custom nginx config? No problem, you can inject through this environment variable. **NOTE:** would be discarded if `/etc/nginx/server.conf` is present. | @@ -63,6 +63,8 @@ Below is the complete list of available options that can be used to customize yo | `TRAILING_SLASH` | `true` | Specifies if paths should end with a trailing slash or not. Prevents [duplicated content](https://moz.com/learn/seo/duplicate-content) by redirecting requests to URLs ending with a slash to its non-trailing-slash equivalent if set to `true` and the other way around for `false`. | | `WORKER_CONNECTIONS` | `1024` | The maximum number of simultaneous connections that can be opened by a worker process. See http://nginx.org/en/docs/ngx_core_module.html#worker_connections | | `DISABLE_FILE_CACHE` | `false` | Disables nginx's open file cache for when used with a network storage (NFS, SMB, etc) | +| `CLIENT_MAX_BODY_SIZE` | `64k` | Overriding client_max_body_size | + ### Append rules for the server block in nginx config From 94ccc9e43d6dae8ed0558f566398150c8d77c13a Mon Sep 17 00:00:00 2001 From: Gatsby Lee Date: Fri, 29 Dec 2023 01:38:15 -0800 Subject: [PATCH 8/9] Update README.md --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bb8f765..373f95a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +NOTE: The original project seems not active, so I forked the repo and built own Images. + + # gatsbyjs/gatsby-docker Docker image that builds and hosts a Gatsby site. @@ -9,14 +12,19 @@ This image has two major tags: 2. `onbuild` - builds your project and creates a new docker image +## Images + +https://hub.docker.com/repository/docker/wowbro/gatsbyjs-docker/general + + ## Usage 1. Create at the root of your project a `Dockerfile` and `.dockerignore`, as below: _Dockerfile_ ```dockerfile - FROM gatsbyjs/gatsby:onbuild as build + FROM wowbro/gatsbyjs-docker:onbuild as build - FROM gatsbyjs/gatsby + FROM wowbro/gatsbyjs-docker:latest COPY --from=build /app/public /pub ``` _.dockerignore_ From 674e9467c3cbef0d4916a4dd52f24c9829b87165 Mon Sep 17 00:00:00 2001 From: Gatsby Lee Date: Fri, 29 Dec 2023 10:09:05 -0800 Subject: [PATCH 9/9] change base image to bookworm --- Dockerfile.onbuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.onbuild b/Dockerfile.onbuild index eb3d049..24ed916 100644 --- a/Dockerfile.onbuild +++ b/Dockerfile.onbuild @@ -1,4 +1,4 @@ -FROM node:20-buster +FROM node:20-bookworm RUN yarn global add gatsby-cli ONBUILD WORKDIR /app