diff --git a/images/nginx-spa/Dockerfile b/images/nginx-spa/Dockerfile new file mode 100644 index 0000000..c6a62d8 --- /dev/null +++ b/images/nginx-spa/Dockerfile @@ -0,0 +1,7 @@ +FROM nginx:stable-alpine + +RUN sed -i '1idaemon off;' /etc/nginx/nginx.conf + +COPY images/nginx-spa/nginx.conf /etc/nginx/conf.d/default.conf + +ENTRYPOINT ["nginx"] diff --git a/images/nginx-spa/README.md b/images/nginx-spa/README.md new file mode 100644 index 0000000..aded9a7 --- /dev/null +++ b/images/nginx-spa/README.md @@ -0,0 +1,16 @@ +# node-distroless + +This image combines the compactness and security of distroless with the convenience of dumb-init for process management, making Node.js applications run more stably in a container environment. + +> This image is maintained with node latest LTS version + +## Usage + +The simple usage example + +```dockerfile +FROM ghcr.io/ebizbase/node-distroless +WORKDIR /usr/src/app +COPY . . +CMD [ "index.js" ] +``` diff --git a/images/nginx-spa/nginx.conf b/images/nginx-spa/nginx.conf new file mode 100644 index 0000000..38db5ff --- /dev/null +++ b/images/nginx-spa/nginx.conf @@ -0,0 +1,20 @@ +server { + listen 80 default_server; + + gzip on; + gzip_min_length 1000; + gzip_types text/plain text/xml application/javascript text/css; + + root /app; + + location / { + add_header Cache-Control "no-store"; + try_files $uri $uri/index.html /index.html; + } + + location ~ \.(?!html) { + add_header Cache-Control "public, max-age=2678400"; + try_files $uri =404; + } + +} diff --git a/images/nginx-spa/project.json b/images/nginx-spa/project.json new file mode 100644 index 0000000..6065067 --- /dev/null +++ b/images/nginx-spa/project.json @@ -0,0 +1,39 @@ +{ + "name": "nginx-spa", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "projectType": "library", + "metadata": { + "version": "1.0.0", + "registries": ["ghcr.io", "docker.io"], + "namespace": "ebizbase/nginx-spa", + "labels": { + "org.opencontainers.image.source": "https://github.com/ebizbase/dev-infras", + "org.opencontainers.image.description": "Nginx image for SPA", + "org.opencontainers.image.licenses": "MIT" + } + }, + "tags": [], + "targets": { + "build": { + "executor": "@ebizbase/nx-docker:build", + "options": { + "load": true, + "tags": ["edge"] + } + }, + "test": { + "dependsOn": ["build"], + "executor": "nx:run-commands", + "options": { + "command": "docker run --rm ebizbase/nginx-spa:edge -T" + } + }, + "publish": { + "executor": "@ebizbase/nx-docker:build", + "options": { + "push": true, + "tags": ["latest", "{major}", "{major}.{minor}", "{major}.{minor}.{patch}"] + } + } + } +} diff --git a/release-config.json b/release-config.json index b70f0f2..c2fd737 100644 --- a/release-config.json +++ b/release-config.json @@ -113,6 +113,16 @@ "jsonpath": "$.metadata.version" } ] + }, + "images/nginx-spa": { + "package-name": "nginx-spa", + "extra-files": [ + { + "type": "json", + "path": "project.json", + "jsonpath": "$.metadata.version" + } + ] } } } diff --git a/release-manifest.json b/release-manifest.json index 5220154..e4de0d9 100644 --- a/release-manifest.json +++ b/release-manifest.json @@ -11,5 +11,6 @@ "devcontainer-images/node-dind-devcontainer": "1.0.0", "devcontainer-images/node-dind-playwright-devcontainer": "1.0.0", "devcontainer-images/node-playwright-devcontainer": "1.0.0", - "images/node-distroless": "1.0.0" + "images/node-distroless": "1.0.0", + "images/nginx-spa": "0.0.0" }