Skip to content

Commit

Permalink
fix: add build-n-push; add husky
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksii-honchar committed Jul 29, 2024
1 parent ef399db commit c85fad7
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 9 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/docker-build-n-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
uses: googleapis/release-please-action@v4
with:
release-type: node
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.PERSONAL_GH_TOKEN }}
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm code:check
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 . .
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <type>
@docker push $(DOCKERHUB_USERNAME)/$(IMAGE_NAME):$(IMAGE_VERSION)
@docker push $(DOCKERHUB_USERNAME)/$(IMAGE_NAME):latest
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -74,4 +76,4 @@
"engines": {
"node": "^22"
}
}
}
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c85fad7

Please sign in to comment.