Skip to content

Commit c538d3c

Browse files
kaiehrhardtAdeAttwood
authored andcommitted
chore(container): add initial container wrapper and build action
1 parent 8806efc commit c538d3c

File tree

5 files changed

+96
-1
lines changed

5 files changed

+96
-1
lines changed

.github/workflows/container-build.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: container build
2+
on:
3+
push:
4+
tags:
5+
- '**'
6+
branches:
7+
- '**'
8+
- '!master'
9+
schedule:
10+
- cron: '0 0 * * *'
11+
jobs:
12+
container-build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: checkout
16+
uses: actions/checkout@v3
17+
- name: Set up QEMU
18+
uses: docker/setup-qemu-action@v3
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v2
21+
- name: Log into registry
22+
uses: docker/login-action@v3
23+
with:
24+
username: ${{ secrets.DOCKERHUB_USERNAME }}
25+
password: ${{ secrets.DOCKERHUB_TOKEN }}
26+
- name: Docker meta
27+
id: meta
28+
uses: docker/metadata-action@v5
29+
with:
30+
images: commitlint/commitlint
31+
tags: |
32+
type=semver,pattern={{version}}
33+
type=edge,branch=master
34+
type=ref,event=branch
35+
type=sha,prefix=,format=short
36+
- name: Build and push container image
37+
uses: docker/build-push-action@v5
38+
with:
39+
context: .
40+
file: Dockerfile.ci
41+
push: true
42+
tags: ${{ steps.meta.outputs.tags }}
43+
labels: ${{ steps.meta.outputs.labels }}
44+
# disable arm build for now, because of https://github.com/nodejs/docker-node/issues/1335
45+
platforms: linux/amd64 #,linux/arm64

Dockerfile.ci

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM docker.io/library/node:18-buster AS builder
2+
WORKDIR /src
3+
COPY . ./
4+
RUN yarn install && \
5+
yarn run build && \
6+
# Commit lint CLI packages
7+
npm pack @commitlint/cli && \
8+
npm pack @commitlint/config-validator && \
9+
npm pack @commitlint/ensure && \
10+
npm pack @commitlint/execute-rule && \
11+
npm pack @commitlint/format && \
12+
npm pack @commitlint/is-ignored && \
13+
npm pack @commitlint/lint && \
14+
npm pack @commitlint/load && \
15+
npm pack @commitlint/message && \
16+
npm pack @commitlint/parse && \
17+
npm pack @commitlint/read && \
18+
npm pack @commitlint/resolve-extends && \
19+
npm pack @commitlint/rules && \
20+
npm pack @commitlint/to-lines && \
21+
npm pack @commitlint/top-level && \
22+
npm pack @commitlint/types && \
23+
# Default commitlint config
24+
npm pack @commitlint/config-conventional
25+
26+
FROM docker.io/library/node:18-buster
27+
COPY --from=builder /src/*.tgz ./
28+
RUN npm install -g *.tgz && \
29+
rm -rf *.tgz
30+
ENTRYPOINT ["commitlint"]
File renamed without changes.

docker-compose.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
version: '3'
22
services:
33
commitlint:
4-
build: .
4+
build:
5+
context: .
6+
dockerfile: Dockerfile.dev
57
image: marionebl/commitlint-cubicle
68
ports:
79
- '8443:8443'

docs/guides-ci-setup.md

+18
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,30 @@ workflows:
121121
## GitLab CI
122122
123123
```yaml
124+
stages: ["lint","build","test"]
124125
lint:commit:
126+
image: registry.hub.docker.com/library/node:alpine
125127
stage: lint
128+
before_script:
129+
- apk add --no-cache git
130+
- npm install --save-dev @commitlint/config-conventional @commitlint/cli
126131
script:
127132
- echo "${CI_COMMIT_MESSAGE}" | npx commitlint
128133
```
129134
135+
## GitLab CI with pre-build container
136+
137+
```yaml
138+
stages: ["lint","build","test"]
139+
lint:commit:
140+
image:
141+
name: registry.hub.docker.com/commitlint/commitlint:latest
142+
entrypoint: [""]
143+
stage: lint
144+
script:
145+
- echo "${CI_COMMIT_MESSAGE}" | commitlint
146+
```
147+
130148
### 3rd party integrations
131149
132150
#### [Codemagic](https://codemagic.io/)

0 commit comments

Comments
 (0)