Skip to content

Commit df2bd70

Browse files
authored
Merge pull request #2 from wesleyhf/improving
Improving GitHub Action + README
2 parents 10f8a0b + 6b18340 commit df2bd70

4 files changed

Lines changed: 174 additions & 112 deletions

File tree

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
9+
- package-ecosystem: "docker"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"

.github/workflows/ci-cd.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: CI/CD
2+
3+
on: [push, workflow_dispatch]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
version: [10, 12, 14]
11+
type: ['', '-qa']
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v1
19+
20+
- name: Cache Docker layers
21+
uses: actions/cache@v2
22+
with:
23+
path: /tmp/.buildx-cache
24+
key: docker-buildx-${{ matrix.version }}${{ matrix.type }}-${{ github.sha }}
25+
restore-keys: docker-buildx-${{ matrix.version }}${{ matrix.type }}-
26+
27+
- name: Build
28+
run: |
29+
docker buildx build \
30+
--cache-from type=local,src=/tmp/.buildx-cache/${{ matrix.version }}${{ matrix.type }} \
31+
--cache-to type=local,dest=/tmp/.buildx-cache/${{ matrix.version }}${{ matrix.type }} \
32+
--output type=docker \
33+
--tag kooldev/node:${{ matrix.version }}${{ matrix.type }} \
34+
${{ matrix.version }}${{ matrix.type }}
35+
36+
- name: Build (adonis)
37+
run: |
38+
docker buildx build \
39+
--cache-from type=local,src=/tmp/.buildx-cache/${{ matrix.version }}-adonis${{ matrix.type }} \
40+
--cache-to type=local,dest=/tmp/.buildx-cache/${{ matrix.version }}-adonis${{ matrix.type }} \
41+
--output type=docker \
42+
--tag kooldev/node:${{ matrix.version }}-adonis${{ matrix.type }} \
43+
${{ matrix.version }}-adonis${{ matrix.type }}
44+
45+
- name: Build (nest)
46+
run: |
47+
docker buildx build \
48+
--cache-from type=local,src=/tmp/.buildx-cache/${{ matrix.version }}-nest${{ matrix.type }} \
49+
--cache-to type=local,dest=/tmp/.buildx-cache/${{ matrix.version }}-nest${{ matrix.type }} \
50+
--output type=docker \
51+
--tag kooldev/node:${{ matrix.version }}-nest${{ matrix.type }} \
52+
${{ matrix.version }}-nest${{ matrix.type }}
53+
54+
- name: Build (latest)
55+
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-node' && matrix.version == '14'
56+
run: |
57+
docker tag kooldev/node:${{ matrix.version }} kooldev/node:latest
58+
docker tag kooldev/node:${{ matrix.version }}-qa kooldev/node:qa
59+
docker tag kooldev/node:${{ matrix.version }}-adonis kooldev/node:adonis
60+
docker tag kooldev/node:${{ matrix.version }}-adonis-qa kooldev/node:adonis-qa
61+
docker tag kooldev/node:${{ matrix.version }}-nest kooldev/node:nest
62+
docker tag kooldev/node:${{ matrix.version }}-nest-qa kooldev/node:nest-qa
63+
64+
- name: Tests
65+
run: |
66+
for suffix in '' -adonis -nest; do
67+
docker run kooldev/node:${{ matrix.version }}$suffix${{ matrix.type }} node -v;
68+
docker run kooldev/node:${{ matrix.version }}$suffix${{ matrix.type }} npm -v;
69+
docker run kooldev/node:${{ matrix.version }}$suffix${{ matrix.type }} yarn -v;
70+
71+
docker run -e ASUSER=1000 kooldev/node:${{ matrix.version }}$suffix${{ matrix.type }} node -v;
72+
docker run -e ASUSER=1000 kooldev/node:${{ matrix.version }}$suffix${{ matrix.type }} npm -v;
73+
docker run -e ASUSER=1000 kooldev/node:${{ matrix.version }}$suffix${{ matrix.type }} yarn -v;
74+
done
75+
76+
- name: Login to DockerHub
77+
uses: docker/login-action@v1
78+
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-node'
79+
with:
80+
username: ${{ secrets.DOCKER_USERNAME }}
81+
password: ${{ secrets.DOCKER_PASSWORD }}
82+
83+
- name: Push to DockerHub
84+
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-node'
85+
run: |
86+
docker push kooldev/node:${{ matrix.version }}${{ matrix.type }}
87+
docker push kooldev/node:${{ matrix.version }}-adonis${{ matrix.type }}
88+
docker push kooldev/node:${{ matrix.version }}-nest${{ matrix.type }}
89+
90+
- name: Push to DockerHub (latest)
91+
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-node' && matrix.version == '14'
92+
run: |
93+
docker push kooldev/node:latest
94+
docker push kooldev/node:qa
95+
docker push kooldev/node:adonis
96+
docker push kooldev/node:adonis-qa
97+
docker push kooldev/node:nest
98+
docker push kooldev/node:nest-qa

.github/workflows/docker.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

README.md

Lines changed: 64 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,77 @@
1-
# kool-dev/docker-node
1+
![CI/CD](https://github.com/kool-dev/docker-node/workflows/CI/CD/badge.svg)
22

3-
<p align="center">
4-
<a href="https://github.com/kool-dev/docker-node/actions"><img src="https://github.com/kool-dev/docker-node/workflows/CI/badge.svg" alt="Github Actions Build Status"></a>
5-
</p>
3+
## Description
64

7-
Minimal Node Docker image focused on Laravel applications. Its use is intended for [fwd](https://github.com/kool-dev/fwd), but can fit in any other Node use-case.
5+
Minimal [Node](https://nodejs.org/en/) Docker image. It's use is intended for [kool.dev](https://github.com/kool-dev/kool), but can fit in any other Node use-case.
6+
7+
## Available Tags
8+
9+
### 10
10+
11+
- [10](https://github.com/kool-dev/docker-node/blob/master/10/Dockerfile)
12+
- [10-qa](https://github.com/kool-dev/docker-node/blob/master/10-qa/Dockerfile)
13+
- [10-adonis](https://github.com/kool-dev/docker-node/blob/master/10-adonis/Dockerfile)
14+
- [10-adonis-qa](https://github.com/kool-dev/docker-node/blob/master/10-adonis-qa/Dockerfile)
15+
- [10-nest](https://github.com/kool-dev/docker-node/blob/master/10-nest/Dockerfile)
16+
- [10-nest-qa](https://github.com/kool-dev/docker-node/blob/master/10-nest-qa/Dockerfile)
17+
18+
### 12
19+
20+
- [12](https://github.com/kool-dev/docker-node/blob/master/12/Dockerfile)
21+
- [12-qa](https://github.com/kool-dev/docker-node/blob/master/12-qa/Dockerfile)
22+
- [12-adonis](https://github.com/kool-dev/docker-node/blob/master/12-adonis/Dockerfile)
23+
- [12-adonis-qa](https://github.com/kool-dev/docker-node/blob/master/12-adonis-qa/Dockerfile)
24+
- [12-nest](https://github.com/kool-dev/docker-node/blob/master/12-nest/Dockerfile)
25+
- [12-nest-qa](https://github.com/kool-dev/docker-node/blob/master/12-nest-qa/Dockerfile)
26+
27+
### 14
28+
29+
- [14](https://github.com/kool-dev/docker-node/blob/master/14/Dockerfile)
30+
- [14-qa](https://github.com/kool-dev/docker-node/blob/master/14-qa/Dockerfile)
31+
- [14-adonis](https://github.com/kool-dev/docker-node/blob/master/14-adonis/Dockerfile)
32+
- [14-adonis-qa](https://github.com/kool-dev/docker-node/blob/master/14-adonis-qa/Dockerfile)
33+
- [14-nest](https://github.com/kool-dev/docker-node/blob/master/14-nest/Dockerfile)
34+
- [14-nest-qa](https://github.com/kool-dev/docker-node/blob/master/14-nest-qa/Dockerfile)
35+
36+
## Environment Variables
37+
38+
Variable | Default Value | Description
39+
--- | --- | ---
40+
**ASUSER** | `0` | Changes the user id that executes the commands
41+
**UID** | `0` | Changes the user id that executes the commands **(ignored if ASUSER is provided)**
842

943
## Usage
1044

1145
With `docker run`:
1246

1347
```sh
14-
docker run -it --rm kooldev/node:alpine node -v
48+
docker run -it --rm kooldev/node:14 node -v
49+
```
50+
51+
With environment variables:
52+
53+
```sh
54+
docker run -it --rm -e ASUSER=500 kooldev/node:14 node -v
55+
```
56+
57+
With `docker-compose.yml`:
58+
59+
```yaml
60+
app:
61+
image: kooldev/node:14
62+
environment:
63+
ASUSER: "${$UID}"
1564
```
1665
17-
### Available Tags
18-
19-
- **10**: Node 10
20-
- **10-qa**: Node 10 with QA Utilities: `buddy.js jshint jsinspect eslint`
21-
- **10-andois**: Node 10 with Adonis
22-
- **10-andois-qa**: Node 10 with Adonis and QA Utilities: `buddy.js jshint jsinspect eslint`
23-
- **10-nest**: Node 10 with Nest
24-
- **10-nest-qa**: Node 10 with Nest and QA Utilities: `buddy.js jshint jsinspect eslint`
25-
- **12**: Node 12
26-
- **12-qa**: Node 12 with QA Utilities: `buddy.js jshint jsinspect eslint`
27-
- **12-andois**: Node 12 with Adonis
28-
- **12-andois-qa**: Node 12 with Adonis and QA Utilities: `buddy.js jshint jsinspect eslint`
29-
- **12-nest**: Node 12 with Nest
30-
- **12-nest-qa**: Node 12 with Nest and QA Utilities: `buddy.js jshint jsinspect eslint`
31-
- **14**: Node 14
32-
- **14-qa**: Node 14 with QA Utilities: `buddy.js jshint jsinspect eslint`
33-
- **14-andois**: Node 14 with Adonis
34-
- **14-andois-qa**: Node 14 with Adonis and QA Utilities: `buddy.js jshint jsinspect eslint`
35-
- **14-nest**: Node 14 with Nest
36-
- **14-nest-qa**: Node 14 with Nest and QA Utilities: `buddy.js jshint jsinspect eslint`
37-
- **latest**: Node 14
38-
- **qa**: Node 14 with QA Utilities: `buddy.js jshint jsinspect eslint`
39-
- **andois**: Node 14 with Adonis
40-
- **andois-qa**: Node 14 with Adonis and QA Utilities: `buddy.js jshint jsinspect eslint`
41-
- **nest**: Node 14 with Nest
42-
- **nest-qa**: Node 14 with Nest and QA Utilities: `buddy.js jshint jsinspect eslint`
43-
44-
45-
### Variables
46-
47-
**ASUSER**: Changes the user id that executes the commands
66+
## Contributing
67+
68+
### Dependencies
69+
70+
- [fwd](https://github.com/fireworkweb/fwd#fireworkwebfwd)
71+
72+
You should change `fwd-template.json` and `template` folder.
73+
74+
After your changes, just run `fwd template` to compile the template and generate all version folder/files.
4875

4976
## License
5077

0 commit comments

Comments
 (0)