Skip to content

Commit

Permalink
doc: add docker compose document.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jul 6, 2023
1 parent a0e3594 commit b974622
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 1 deletion.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,44 @@
`P`assword `M`anager `L`ite
===

[![Node.js CI](https://github.com/jaywcjlove/pml/actions/workflows/main.yml/badge.svg)](https://github.com/jaywcjlove/pml/actions/workflows/main.yml)
[![Docker Image Version (latest by date)](https://img.shields.io/docker/v/wcjiang/pml)](https://hub.docker.com/r/wcjiang/pml)
[![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/wcjiang/pml)](https://hub.docker.com/r/wcjiang/pml)
[![Docker Pulls](https://img.shields.io/docker/pulls/wcjiang/pml)](https://hub.docker.com/r/wcjiang/pml)

Password Manager Lite.

## Docker

Create a **`docker-compose.yml`** file and add the following configuration:

```yml
version: '3.8'
services:
postgres:
image: postgres:latest
environment:
- POSTGRES_PASSWORD=wcjiang
restart: always

pml:
image: pml:latest
ports:
- 3560:3002
environment:
- POSTGRES_HOST=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=wcjiang
- POSTGRES_DB=pml
depends_on:
- postgres
```
Run the following command to **start** the container
```bash
docker-compose --project-name pml-server up -d
docker-compose -p pml-server -f docker-compose.yml down --remove-orphans --rmi local -v
# Or
docker stack deploy -c docker-compose.yml pml-server
```
59 changes: 58 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
Docker
===

[![Node.js CI](https://github.com/jaywcjlove/pml/actions/workflows/main.yml/badge.svg)](https://github.com/jaywcjlove/pml/actions/workflows/main.yml)
[![Docker Image Version (latest by date)](https://img.shields.io/docker/v/wcjiang/pml)](https://hub.docker.com/r/wcjiang/pml)
[![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/wcjiang/pml)](https://hub.docker.com/r/wcjiang/pml)
[![Docker Pulls](https://img.shields.io/docker/pulls/wcjiang/pml)](https://hub.docker.com/r/wcjiang/pml)

## Docker start service

```bash
$ cd docker/
$ docker build -t pml .
```

Start the **postgres** container

```bash
docker run \
-p 5432:5432 \
-e POSTGRES_PASSWORD=wcjiang \
--name postgres \
--restart always \
-d \
postgres:latest
```

Start the **pml** container

```bash
$ docker run --name pml \
-p 3560:3002 \
Expand All @@ -12,4 +34,39 @@ $ docker run --name pml \
-e POSTGRES_PASSWORD=wcjiang \
-e POSTGRES_DB=pml \
-d pml
```

## Docker Compose

```yml
version: '3.8'
services:
postgres:
image: postgres:latest
# ports:
# - 5432:5432
environment:
- POSTGRES_PASSWORD=wcjiang
restart: always

pml:
image: pml:latest
ports:
- 3560:3002
environment:
- POSTGRES_HOST=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=wcjiang
- POSTGRES_DB=pml
depends_on:
- postgres
```
Run the following command to start the container
```bash
docker-compose --project-name pml-server up -d
docker-compose -p pml-server -f docker-compose.yml down --remove-orphans --rmi local -v
# Or
docker stack deploy -c docker-compose.yml pml-server
```
21 changes: 21 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '3.8'
services:
postgres:
image: postgres:latest
# ports:
# - 5432:5432
environment:
- POSTGRES_PASSWORD=wcjiang
restart: always

pml:
image: pml:latest
ports:
- 3560:3002
environment:
- POSTGRES_HOST=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=wcjiang
- POSTGRES_DB=pml
depends_on:
- postgres

0 comments on commit b974622

Please # to comment.