diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 1c4b655..9b7ff3a 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -46,6 +46,15 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Cache artifacts + uses: actions/cache@v3 + continue-on-error: true + with: + path: {{.github.workspace}}/.skaffold/cache + key: skaffold-${{ hashFiles('**/cache') }} + restore-keys: | + skaffold- + - name: Build Docker images uses: hiberbee/github-action-skaffold@1.22.0 with: diff --git a/README.md b/README.md index 7f19136..44f124f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ #### NodeJS -[Dockerfile](images/build/Dockerfile) +[Dockerfile](packages/yarn/Dockerfile) This image used for assembling NodeJS-based applications. Includes Yarn 3 cached packages from `package.json` as [@bn-digital](https://github.com/bn-digital) technology stack foundation. @@ -14,7 +14,7 @@ This image used for assembling NodeJS-based applications. Includes Yarn 3 cached #### HTML -[Dockerfile](images/runtime/Dockerfile) +[Dockerfile](packages/nodejs/Dockerfile) ```dockerfile FROM nginx/unit:${unit_version}-minimal AS html @@ -22,7 +22,7 @@ FROM nginx/unit:${unit_version}-minimal AS html #### NodeJS -[Dockerfile](images/runtime/Dockerfile) +[Dockerfile](packages/nodejs/Dockerfile) ```dockerfile FROM node:${nodejs_version}-bullseye-slim AS nodejs @@ -30,7 +30,7 @@ FROM node:${nodejs_version}-bullseye-slim AS nodejs #### PHP -[Dockerfile](images/runtime/Dockerfile) +[Dockerfile](packages/nodejs/Dockerfile) ```dockerfile FROM nginx/unit:${unit_version}-php${php_version} AS php diff --git a/images/dind/Dockerfile b/packages/dind/Dockerfile similarity index 100% rename from images/dind/Dockerfile rename to packages/dind/Dockerfile diff --git a/images/runtime/Dockerfile b/packages/nodejs/Dockerfile similarity index 75% rename from images/runtime/Dockerfile rename to packages/nodejs/Dockerfile index cf9ded3..246efe0 100644 --- a/images/runtime/Dockerfile +++ b/packages/nodejs/Dockerfile @@ -1,22 +1,21 @@ # syntax docker/dockerfile:latest -ARG unit_version=1.26.1 ARG php_version=8.1 ARG nodejs_version="18" ARG os_version="bullseye-slim" -FROM node:${nodejs_version}-${os_version} AS nodejs-base - -FROM nodejs-base AS nodejs +FROM node:${nodejs_version}-${os_version} LABEL org.opencontainers.image.authors="BN Enginseers" \ + org.opencontainers.image.vendor="BN Digital" \ + org.opencontainers.image.title="NodeJS" \ org.opencontainers.image.url="https://github.com/bn-digital/docker" \ + org.opencontainers.image.base.name="dcr.bndigital.dev/library/nodejs" \ org.opencontainers.image.source="https://github.com/bn-digital/docker" \ - org.opencontainers.image.vendor="BN Digital" \ org.opencontainers.image.licenses="MIT" ENV NODE_NO_WARNINGS=1 ENV HOST=0.0.0.0 ENV PORT=5000 ENV NODE_ENV=production EXPOSE $PORT -RUN npm install --global \ +RUN npm install --location=global \ serve \ npm USER node diff --git a/images/runtime/docker-entrypoint.d/html.json b/packages/nodejs/docker-entrypoint.d/html.json similarity index 100% rename from images/runtime/docker-entrypoint.d/html.json rename to packages/nodejs/docker-entrypoint.d/html.json diff --git a/images/runtime/docker-entrypoint.d/nodejs.json b/packages/nodejs/docker-entrypoint.d/nodejs.json similarity index 100% rename from images/runtime/docker-entrypoint.d/nodejs.json rename to packages/nodejs/docker-entrypoint.d/nodejs.json diff --git a/images/runtime/docker-entrypoint.d/php.json b/packages/nodejs/docker-entrypoint.d/php.json similarity index 100% rename from images/runtime/docker-entrypoint.d/php.json rename to packages/nodejs/docker-entrypoint.d/php.json diff --git a/images/runtime/docker-entrypoint.sh b/packages/nodejs/docker-entrypoint.sh similarity index 100% rename from images/runtime/docker-entrypoint.sh rename to packages/nodejs/docker-entrypoint.sh diff --git a/images/openvpn/Dockerfile b/packages/openvpn/Dockerfile similarity index 100% rename from images/openvpn/Dockerfile rename to packages/openvpn/Dockerfile diff --git a/images/build/.dockerignore b/packages/yarn/.dockerignore similarity index 100% rename from images/build/.dockerignore rename to packages/yarn/.dockerignore diff --git a/images/build/Dockerfile b/packages/yarn/Dockerfile similarity index 96% rename from images/build/Dockerfile rename to packages/yarn/Dockerfile index e410e28..9fd0dbd 100644 --- a/images/build/Dockerfile +++ b/packages/yarn/Dockerfile @@ -1,7 +1,7 @@ # syntax docker/dockerfile:latest ARG nodejs_version="18" ARG os_version="bullseye-slim" -FROM node:${nodejs_version}-${os_version} AS yarn +FROM node:${nodejs_version}-${os_version} RUN apt-get update --fix-missing \ && apt-get upgrade --yes \ && apt-get dist-upgrade --yes \ diff --git a/images/build/app/.yarn/releases/yarn-4.0.0-rc.14.git.20220821.hash-e0d8a1b.cjs b/packages/yarn/app/.yarn/releases/yarn-4.0.0-rc.14.git.20220821.hash-e0d8a1b.cjs similarity index 100% rename from images/build/app/.yarn/releases/yarn-4.0.0-rc.14.git.20220821.hash-e0d8a1b.cjs rename to packages/yarn/app/.yarn/releases/yarn-4.0.0-rc.14.git.20220821.hash-e0d8a1b.cjs diff --git a/images/build/app/.yarnrc.yml b/packages/yarn/app/.yarnrc.yml similarity index 100% rename from images/build/app/.yarnrc.yml rename to packages/yarn/app/.yarnrc.yml diff --git a/images/build/app/package.json b/packages/yarn/app/package.json similarity index 97% rename from images/build/app/package.json rename to packages/yarn/app/package.json index fdff0b0..adf6fc8 100644 --- a/images/build/app/package.json +++ b/packages/yarn/app/package.json @@ -45,9 +45,8 @@ "commander": "^9.4.0", "core-js": "^3.25.0", "cross-env": "^7.0.3", - "cypress": "^10.6.0", "date-fns": "^2.29.2", - "dotenv": "^16.0.1", + "dotenv": "^16.0.2", "esbuild": "^0.15.6", "graphql": "^16.6.0", "gsap": "^3.11.0", @@ -73,7 +72,7 @@ "react-router": "^6.4.0-pre.13", "react-router-dom": "^6.4.0-pre.13", "react-use": "^17.4.0", - "sass": "^1.54.6", + "sass": "^1.54.7", "sharp": "^0.30.7", "sqlite3": "^5.0.11", "strapi-plugin-config-sync": "^1.0.3", @@ -97,7 +96,7 @@ "@types/react-router-hash-link": "^2.4.5", "@types/uuid": "^8.3.4", "@vscode/sqlite3": "^5.0.8", - "cypress": "^10.6.0", + "cypress": "^10.7.0", "nodemon": "^2.0.19", "ts-node": "^10.9.1", "tslib": "^2.4.0", diff --git a/images/build/app/skaffold.yaml b/packages/yarn/app/skaffold.yaml similarity index 100% rename from images/build/app/skaffold.yaml rename to packages/yarn/app/skaffold.yaml diff --git a/images/build/app/yarn.lock b/packages/yarn/app/yarn.lock similarity index 99% rename from images/build/app/yarn.lock rename to packages/yarn/app/yarn.lock index a3f5644..5218a61 100644 --- a/images/build/app/yarn.lock +++ b/packages/yarn/app/yarn.lock @@ -5325,9 +5325,9 @@ __metadata: commander: "npm:^9.4.0" core-js: "npm:^3.25.0" cross-env: "npm:^7.0.3" - cypress: "npm:^10.6.0" + cypress: "npm:^10.7.0" date-fns: "npm:^2.29.2" - dotenv: "npm:^16.0.1" + dotenv: "npm:^16.0.2" esbuild: "npm:^0.15.6" graphql: "npm:^16.6.0" gsap: "npm:^3.11.0" @@ -5354,7 +5354,7 @@ __metadata: react-router: "npm:^6.4.0-pre.13" react-router-dom: "npm:^6.4.0-pre.13" react-use: "npm:^17.4.0" - sass: "npm:^1.54.6" + sass: "npm:^1.54.7" sharp: "npm:^0.30.7" sqlite3: "npm:^5.0.11" strapi-plugin-config-sync: "npm:^1.0.3" @@ -14584,9 +14584,9 @@ __metadata: languageName: node linkType: hard -"cypress@npm:^10.6.0": - version: 10.6.0 - resolution: "cypress@npm:10.6.0" +"cypress@npm:^10.7.0": + version: 10.7.0 + resolution: "cypress@npm:10.7.0" dependencies: "@cypress/request": "npm:^2.88.10" "@cypress/xvfb": "npm:^1.2.4" @@ -14632,7 +14632,7 @@ __metadata: yauzl: "npm:^2.10.0" bin: cypress: bin/cypress - checksum: 3c64a924158d5cffe7048cdfbeb0dbcacdb4bdce0e3e469e183360713a25755278b59c6eff903223916cfa4fd3905135e604817329e2bad3949c04eed23a2c64 + checksum: 3ad2c992cc4379db39b456c21822413ea4e87b18934853c05c06f28373eb13adf6c3c414ba958b36921241bc161eff74edc2381729cd677543077324350cd77a languageName: node linkType: hard @@ -15673,6 +15673,13 @@ __metadata: languageName: node linkType: hard +"dotenv@npm:^16.0.2": + version: 16.0.2 + resolution: "dotenv@npm:16.0.2" + checksum: 5d6641fbee9e169fdea93c4952c9559230418d9de58ce7c9cb49ae8bca5445686fd8222f952a0b916baa1119eaa4be76d096c3db795395bbf3c0bb1c85e33f8c + languageName: node + linkType: hard + "dotenv@npm:^8.2.0": version: 8.6.0 resolution: "dotenv@npm:8.6.0" @@ -30809,16 +30816,16 @@ __metadata: languageName: node linkType: hard -"sass@npm:^1.54.6": - version: 1.54.6 - resolution: "sass@npm:1.54.6" +"sass@npm:^1.54.7": + version: 1.54.7 + resolution: "sass@npm:1.54.7" dependencies: chokidar: "npm:>=3.0.0 <4.0.0" immutable: "npm:^4.0.0" source-map-js: "npm:>=0.6.2 <2.0.0" bin: sass: sass.js - checksum: 3d38b672e06e9e87dbeb329dd6cfef21ca09f4441d69faa517282379e319fb6817d8d173cb9aede571d328dc0e689039597d89cc0cd14db52aa8eef294f7c5d3 + checksum: 484d49852029f05d4bdbe6e006856a256f74e252362613a72cda24dd690c4401040d0b206a6747e58db51f411597b60e6348733523d72cf4af8a6092f07fd0ec languageName: node linkType: hard diff --git a/images/build/test/cms.yaml b/packages/yarn/test/cms.yaml similarity index 100% rename from images/build/test/cms.yaml rename to packages/yarn/test/cms.yaml diff --git a/images/build/test/nodejs.yaml b/packages/yarn/test/nodejs.yaml similarity index 100% rename from images/build/test/nodejs.yaml rename to packages/yarn/test/nodejs.yaml diff --git a/images/build/test/website.yaml b/packages/yarn/test/website.yaml similarity index 100% rename from images/build/test/website.yaml rename to packages/yarn/test/website.yaml diff --git a/skaffold.yaml b/skaffold.yaml index 72da623..db20c77 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -4,17 +4,13 @@ kind: Config build: artifacts: - image: yarn - context: images/build - docker: - target: yarn + context: packages/yarn - image: openvpn - context: images/openvpn + context: packages/openvpn - image: nodejs - context: images/runtime - docker: - target: nodejs + context: packages/nodejs - image: dind - context: images/dind + context: packages/nodejs tagPolicy: sha256: { } local: @@ -30,6 +26,9 @@ test: - nodejs-container-structure-test.yaml - runtime-container-structure-test.yaml profiles: + - name: staging + activation: + - env: CI=true - name: production build: tagPolicy: