Skip to content

Instantly share code, notes, and snippets.

@myriaglot
Created July 26, 2026 05:23
Show Gist options
  • Select an option

  • Save myriaglot/72a942f0ff1785581131ba29fa29f8e5 to your computer and use it in GitHub Desktop.

Select an option

Save myriaglot/72a942f0ff1785581131ba29fa29f8e5 to your computer and use it in GitHub Desktop.
how to do basic devops

For a Docker locally + Podman in production setup, the common flow is:

Production server using Podman Compose

cd /path/to/project

git pull

podman-compose build
podman-compose up -d

A safer version that removes outdated containers is:

git pull
podman-compose build
podman-compose up -d --remove-orphans

When do you need to rebuild?

Application source code changed

For example:

  • React components
  • Node.js files
  • TypeScript files
  • CSS
  • configuration copied into the image

Run:

podman-compose build
podman-compose up -d

The image must be rebuilt because your Dockerfile probably does something like:

COPY . .
RUN npm run build

The existing container does not automatically receive files from git pull.

package.json or lock file changed

Run:

podman-compose build --no-cache
podman-compose up -d

Usually a normal build is enough because the build cache detects changed files:

podman-compose build

Use --no-cache only when dependencies appear stale or the normal build behaves incorrectly.

Only environment variables changed

If your compose file loads .env variables at container startup, you usually do not need to rebuild:

podman-compose up -d --force-recreate

However, React frontend variables are often inserted during the build. Changes to variables such as VITE_API_URL or REACT_APP_API_URL may require:

podman-compose build
podman-compose up -d

Only docker-compose.yml changed

Usually run:

podman-compose up -d --build

This recreates the affected containers and builds images when necessary.

Recommended deployment command

For most deployments:

git pull &&
podman-compose up -d --build --remove-orphans

Then check:

podman-compose ps
podman-compose logs --tail=100 app

Replace app with the service name from your docker-compose.yml.

Docker locally

The equivalent local command is:

docker compose up -d --build

So the mapping is:

Local Mac                   Production server

docker compose build        podman-compose build
docker compose up -d        podman-compose up -d
docker compose logs app     podman-compose logs app
docker compose down         podman-compose down

Important note about PM2

When PM2 is running inside the container, you normally do not run this manually on the server:

pm2 restart app

Instead, rebuild or recreate the container:

podman-compose up -d --build

Podman replaces the old container, starts the new one, and PM2 starts again through the container's CMD or ENTRYPOINT.

A practical production deployment script would be:

#!/usr/bin/env bash
set -e

cd /root/project/my-app

git pull
podman-compose up -d --build --remove-orphans

podman-compose ps
podman-compose logs --tail=50 app

The key rule is: git pull updates files on the server, but rebuilding the image is what puts those updated files inside the production container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment