Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
node_modules
dist
.git
.github
.circleci
*.md
LICENSE
.gitignore
sample
*.log
.DS_Store
coverage
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,20 @@ jobs:
node-version: 20
- run: npm install
- run: npm test

docker-smoke-test:
name: Docker Smoke Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@main
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using @main for GitHub Actions is not recommended as it can lead to unexpected breaking changes. Pin to a specific version tag (e.g., @v4) to ensure reproducible builds.

Copilot uses AI. Check for mistakes.
- name: Build Docker image
run: docker build -t bev-test .
- name: Test valid catalog-info
run: docker run --rm -v ${{ github.workspace }}/sample:/workdir bev-test catalog-info.yml
- name: Test invalid catalog-info fails
run: |
if docker run --rm -v ${{ github.workspace }}/sample:/workdir bev-test invalid-catalog-info.yml; then
echo "Expected validation to fail but it passed"
exit 1
fi
33 changes: 33 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: docker-publish
on:
push:
branches:
- main
jobs:
publish:
name: docker-publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get version from package.json
id: version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
roadiehq/backstage-entity-validator:${{ steps.version.outputs.VERSION }}
roadiehq/backstage-entity-validator:latest
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Build stage
FROM node:20-alpine AS builder
Copy link
Contributor

@Xantier Xantier Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bump to current LTS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


WORKDIR /app

# Copy package files
COPY package.json yarn.lock ./

# Install all dependencies (including devDependencies for build)
RUN yarn install --frozen-lockfile --ignore-scripts

# Copy source files
COPY src/ ./src/
COPY bin/ ./bin/

# Build the project
RUN yarn run prepare

# Production stage
FROM node:20-alpine

WORKDIR /app

# Copy built files from builder (ncc bundles all dependencies)
COPY --from=builder /app/dist/ ./dist/

# Create a directory for mounting files to validate
RUN mkdir /workdir
WORKDIR /workdir

# Set the entrypoint to the validator
ENTRYPOINT ["node", "/app/dist/index.js"]

# Default to showing help (no args will validate current directory)
CMD []
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,27 @@ usage:
path: catalog-info.yaml
```

## Docker

The validator is available as a Docker image at `roadiehq/backstage-entity-validator`.

### Usage

```bash
# Validate a file in the current directory
docker run --rm -v $(pwd):/workdir roadiehq/backstage-entity-validator catalog-info.yaml

# Validate multiple files
docker run --rm -v $(pwd):/workdir roadiehq/backstage-entity-validator catalog-info.yaml other-file.yaml

# Validate with glob pattern
docker run --rm -v $(pwd):/workdir roadiehq/backstage-entity-validator "services/*/catalog-info.yaml"
```

### Available Tags

- `latest` - Latest release
- `x.y.z` - Specific version (e.g., `0.6.2`)

## Using the CLI

Expand Down