CI_CD_Docker_GitHubActions
CI_CD_Docker_GitHubActions
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
This example workflow checks out the code, installs dependencies, and runs
tests whenever changes are pushed to the main branch.
Creating a Dockerized Application
Writing a Dockerfile
Create a Dockerfile in the root directory to containerize your application.
Example Dockerfile:
# Use Node.js as the base image
FROM node:16