diff --git a/.github/workflows/docker-build-n-push.yaml b/.github/workflows/docker-build-n-push.yaml index b3e6034..8a1095c 100644 --- a/.github/workflows/docker-build-n-push.yaml +++ b/.github/workflows/docker-build-n-push.yaml @@ -20,8 +20,6 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - run: sudo apt-get update && sudo apt-get install -y jq - - run: make docker-build - - run: make docker-tag-latest - - run: make docker-push + - run: make create-docker-container-builder + - run: make docker-build-n-push - run: docker logout diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index 0aa23e9..f5fa563 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -17,4 +17,4 @@ jobs: uses: googleapis/release-please-action@v4 with: release-type: node - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.PERSONAL_GH_TOKEN }} diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..4f31855 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +pnpm code:check \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index afb1fb4..4a40de5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ #--- BASE --- -FROM tuiteraz/jaba-node:22.3-0 AS base +FROM tuiteraz/jaba-node:22.3-1.1.1 AS base # default workdir = /usr/src/app ENV TZ=Europe/Madrid COPY ./scripts/entrypoint.sh /usr/local/bin/entrypoint.sh -RUN /bin/bash -c "chmod +x /usr/local/bin/entrypoint.sh" +RUN chmod +x /usr/local/bin/entrypoint.sh ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] CMD ["node", "--enable-source-maps", "dist/src/index.js"] #--- BUILD --- -FROM tuiteraz/jaba-build:22.3-0 AS build +FROM tuiteraz/jaba-build:22.3-1.1.1 AS build WORKDIR /tmp COPY . . diff --git a/Makefile b/Makefile index 37cc9e5..64441e7 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,9 @@ endif docker-build: check-node-env ## build docker image docker build --load -f ./Dockerfile --build-arg IMAGE_VERSION=$(IMAGE_VERSION) --build-arg IMAGE_NAME=$(IMAGE_NAME) -t $(DOCKERHUB_USERNAME)/$(IMAGE_NAME):$(IMAGE_VERSION) . +docker-build-n-push: check-node-env ## build docker image + docker buildx build --builder docker-container --platform linux/amd64,linux/arm64 --push -f ./Dockerfile --build-arg IMAGE_VERSION=$(IMAGE_VERSION) --build-arg IMAGE_NAME=$(IMAGE_NAME) -t $(DOCKERHUB_USERNAME)/$(IMAGE_NAME):$(IMAGE_VERSION) -t $(DOCKERHUB_USERNAME)/$(IMAGE_NAME):latest . + docker-push: ## push latest image to docker hub of @docker push $(DOCKERHUB_USERNAME)/$(IMAGE_NAME):$(IMAGE_VERSION) @docker push $(DOCKERHUB_USERNAME)/$(IMAGE_NAME):latest diff --git a/package.json b/package.json index 9bbe56a..a449fb6 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "dotenvx": "dotenvx run --env-file .env", "lint:check": "ESLINT_USE_FLAT_CONFIG=true eslint --config ./eslint.config.js --cache . --max-warnings 0", "lint:fix": "pnpm lint --fix", + "prepare": "husky", "prettier:check": "prettier --check \"{src,test}/**/*.{ts,js,json,md}\"", "prettier:write": "prettier --write \"{src,test}/**/*.{ts,js,json,md}\"", "sort-package-json": "npx sort-package-json", @@ -58,6 +59,7 @@ "eslint-config-prettier": "9.1.0", "eslint-plugin-markdown": "^5.1.0", "globals": "^15.8.0", + "husky": "^9.1.4", "jest": "^29.7.0", "nodemon": "3.1.4", "pino-pretty": "^11.2.1", @@ -74,4 +76,4 @@ "engines": { "node": "^22" } -} \ No newline at end of file +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 89a3a29..15f451b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,6 +66,9 @@ importers: globals: specifier: ^15.8.0 version: 15.8.0 + husky: + specifier: ^9.1.4 + version: 9.1.4 jest: specifier: ^29.7.0 version: 29.7.0(@types/node@20.14.11)(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3)) @@ -1272,6 +1275,11 @@ packages: resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} engines: {node: '>=10.17.0'} + husky@9.1.4: + resolution: {integrity: sha512-bho94YyReb4JV7LYWRWxZ/xr6TtOTt8cMfmQ39MQYJ7f/YE268s3GdghGwi+y4zAeqewE5zYLvuhV0M0ijsDEA==} + engines: {node: '>=18'} + hasBin: true + ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} @@ -3662,6 +3670,8 @@ snapshots: human-signals@2.1.0: {} + husky@9.1.4: {} + ieee754@1.2.1: {} ignore-by-default@1.0.1: {}