Skip to content

Dockerize

Dockerize #3380

Workflow file for this run

name: Dockerize
on:
pull_request_target:
workflow_run:
workflows: ["build"]
types:
- completed
jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Cache Node.js modules
uses: actions/cache@v4
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
# install dependencies and build the project
- run: npx husky-init && npm install --registry=https://registry.npmjs.org
- run: npm run build --if-present
# build docker image.
- name: Build Docker Image
run: |
docker build -t hantsy/nest-sample .
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Push Docker Image
run: docker push hantsy/nest-sample