This application includes
Node.js applicationCI/CD pipeline for the application (GitHub actions)Postgres image as db service with compose configurationdpage/pgadmin4 container as PosgtreSQL UI.GitHub repository with GitHub Actions workflow for CI/CD: https://github.com/berkesayin/developing-with-containers
The image berkesayin/developing-with-containers is built and published using GitHub Actions workflow at the repository. The image is the UI app of todo-server. And here is the usage of this berkesayin/developing-with-containers image with Postgres image for db service using compose configuration.
compose.yaml file:
version: "3.4"
services:
server:
platform: linux/x86_64
image: berkesayin/developing-with-containers:latest
container_name: todo-server-c
ports:
- 3000:3000
- 9229:9229
environment:
NODE_ENV: production
POSTGRES_HOST: db
POSTGRES_USER: postgres
POSTGRES_PASSWORD_FILE: /run/secrets/db-password
POSTGRES_DB: example
depends_on:
db:
condition: service_healthy
secrets:
- db-password
networks:
- todo-network
db:
image: postgres
container_name: postgres-db-c
restart: always
user: postgres
secrets:
- db-password
volumes:
- db-data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=example
- POSTGRES_PASSWORD_FILE=/run/secrets/db-password
- POSTGRES_HOST_AUTH_METHOD=md5
- PGDATA=/var/lib/postgresql/data/pgdata
expose:
- 5432
ports:
- "5432:5432"
healthcheck:
test: [ "CMD", "pg_isready" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- todo-network
volumes:
db-data:
secrets:
db-password:
file: db/password.txt
networks:
todo-network:
driver: bridge
docker-compose up --build
docker images
docker ps
docker network ls
docker run -p 8080:80 \
-e '[email protected]' \
-e 'PGADMIN_DEFAULT_PASSWORD=Resample-Landlady5-Bottle' \
--network=trying_todo-network \
--name=pgadmin-server-cont \
-d dpage/pgadmin4
Go to localhost:8080/
General - Name: my-serverConnection - Hostname / address: db (db service at compose)Connection - port: 5432 (the exposed and default PostgreSQL port at compose)Connection - Maintanance database: example (db name at compose)Connection - Username: postgres (db user at compose)Connection - Password: Resample-Landlady5-Bottle (used for container)Add new items at localhost:3000/ and check database at the PG admin.
Content type
Image
Digest
sha256:b12e36557…
Size
68.7 MB
Last updated
over 2 years ago
docker pull berkesayin/developing-with-containers