Skip to content

Commit

Permalink
Merge pull request #41 from arnidan/setup-ci
Browse files Browse the repository at this point in the history
Build docker image with Github Actions
  • Loading branch information
m3m3nto authored Feb 26, 2024
2 parents 8dfa80d + bfe5a1e commit 6f80444
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build-docker-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: build docker image

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,45 @@ It allows you to optimize the limit of daily requests, with preventive checks, s
$ npm install
```

#### Docker Compose

You can use docker compose config below to start the app with mongodb

<details>
<summary>docker-compose.yaml example</summary>

```yaml
version: "3.8"

services:
app:
image: ghcr.io/m3m3nto/giaa:latest
depends_on:
- mongodb
restart: unless-stopped
ports:
- 3000:3000
environment:
- DB_URL=mongodb://giaa:giaa@mongodb/giaa
volumes:
- ./cids:/app/config/cids

mongodb:
image: mongo:5.0.2
restart: unless-stopped
environment:
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=admin
- MONGO_INITDB_DATABASE=giaa
volumes:
- db:/data/db
- ./init-mongo.js:/docker-entrypoint-initdb.d/mongo-init.js:ro

volumes:
db:
```
</details>
#### Windows
- node installation: https://nodejs.org/en/download/
- mongodb installation: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/#install-mdb-edition
Expand All @@ -45,6 +84,12 @@ Within project dir:
$ npm start
```

#### Docker Compose
Within docker-compose.yaml dir:
```sh
$ docker compose up
```

#### Windows
Within project dir:
```sh
Expand Down

0 comments on commit 6f80444

Please sign in to comment.