Jiaxi Liu (Jesse)

Master’s Graduate

Software Engineer | Scalable APIs · Web Scraping · Data Integration · Code Quality & Refactoring

Back to Blog

Git, GitHub Actions, Shell, and Docker: From Local Development to CI/CD and Containers

These tools solve delivery problems: collaboration, automated testing, packaging, runtime consistency, and deployment.

Git Workflow

Common commands:

git status
git add .
git commit -m "feat: add login"
git pull
git push
git checkout -b feature/login

Common concepts:

  • merge: preserves branch merge history
  • rebase: moves commits onto a new base for linear history
  • reset: moves the current branch pointer and may affect working tree
  • revert: creates a reverse commit, safer for shared branches

GitHub Actions

A workflow is made of triggers and jobs.

name: CI
 
on:
  push:
  pull_request:
  workflow_dispatch:
 
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npm test

Common triggers:

  • push
  • pull_request
  • schedule
  • workflow_dispatch

Git Hooks

Git Hooks are local scripts that run before or after Git actions.

Common uses:

  • format before commit
  • lint before commit
  • test before push
  • validate commit messages

Shell Pipes and Redirection

cat app.log | grep ERROR

A pipe sends output from the left command to the right command.

node script.js > output.txt
node script.js >> output.txt

> overwrites. >> appends.

Docker Concepts

Image is the packaged template. Container is a running instance of an image.

Dockerfile describes how to build an image.

Volume persists data.

Network lets containers communicate.

Dockerfile

FROM node:20
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
EXPOSE 3000
CMD ["npm", "run", "start"]

Copying dependency manifests before source code helps Docker reuse build cache.

docker-compose

docker-compose starts multiple services together.

services:
  web:
    build: .
    ports:
      - "3000:3000"
  db:
    image: postgres:16
    volumes:
      - db-data:/var/lib/postgresql/data
 
volumes:
  db-data:

It is useful for local development, integration tests, and small deployments.