Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide ci and container image #3431

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/container-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: container build
on:
push:
tags:
- '**'
branches:
- '**'
- '!master'
schedule:
- cron: '0 0 * * *'
jobs:
container-build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log into registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: commitlint/commitlint
tags: |
type=semver,pattern={{version}}
type=edge,branch=master
type=ref,event=branch
type=sha,prefix=,format=short
- name: Build and push container image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ci
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# disable arm build for now, because of https://github.com/nodejs/docker-node/issues/1335
platforms: linux/amd64 #,linux/arm64
30 changes: 30 additions & 0 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM docker.io/library/node:18-buster AS builder
WORKDIR /src
COPY . ./
RUN yarn install && \
yarn run build && \
# Commit lint CLI packages
npm pack @commitlint/cli && \
npm pack @commitlint/config-validator && \
npm pack @commitlint/ensure && \
npm pack @commitlint/execute-rule && \
npm pack @commitlint/format && \
npm pack @commitlint/is-ignored && \
npm pack @commitlint/lint && \
npm pack @commitlint/load && \
npm pack @commitlint/message && \
npm pack @commitlint/parse && \
npm pack @commitlint/read && \
npm pack @commitlint/resolve-extends && \
npm pack @commitlint/rules && \
npm pack @commitlint/to-lines && \
npm pack @commitlint/top-level && \
npm pack @commitlint/types && \
# Default commitlint config
npm pack @commitlint/config-conventional

FROM docker.io/library/node:18-buster
COPY --from=builder /src/*.tgz ./
RUN npm install -g *.tgz && \
rm -rf *.tgz
ENTRYPOINT ["commitlint"]
File renamed without changes.
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
version: '3'
services:
commitlint:
build: .
build:
context: .
dockerfile: Dockerfile.dev
image: marionebl/commitlint-cubicle
ports:
- '8443:8443'
Expand Down
18 changes: 18 additions & 0 deletions docs/guides-ci-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,30 @@ workflows:
## GitLab CI

```yaml
stages: ["lint","build","test"]
lint:commit:
image: registry.hub.docker.com/library/node:alpine
stage: lint
before_script:
- apk add --no-cache git
- npm install --save-dev @commitlint/config-conventional @commitlint/cli
script:
- echo "${CI_COMMIT_MESSAGE}" | npx commitlint
```

## GitLab CI with pre-build container

```yaml
stages: ["lint","build","test"]
lint:commit:
image:
name: registry.hub.docker.com/commitlint/commitlint:latest
entrypoint: [""]
stage: lint
script:
- echo "${CI_COMMIT_MESSAGE}" | commitlint
```

### 3rd party integrations

#### [Codemagic](https://codemagic.io/)
Expand Down
Loading