From 5b27eb3529ffea0724f1ff39d0f01f0f144fecce Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 21:24:17 +0000 Subject: [PATCH 1/4] Add Dockerfile, dockerignore, and Docker workflow job Agent-Logs-Url: https://github.com/CenterEdge/fakeit/sessions/c5a3ae69-e9cf-4ed9-966f-94cc9c500ff7 Co-authored-by: brantburnett <7118719+brantburnett@users.noreply.github.com> --- .dockerignore | 11 ++++++++++ .github/workflows/ci.yml | 47 ++++++++++++++++++++++++++++++++++++++++ Dockerfile | 29 +++++++++++++++++++++++++ README.md | 14 ++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..311dff3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +.git +.github +.vscode +node_modules +dist +coverage +test +assets +*.log +.DS_Store +.nyc* diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1635d3..ef35bf5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,53 @@ jobs: - name: Test run: npm test + docker: + name: Docker Build & Publish + needs: build-lint-test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + if: ${{ startsWith(github.ref, 'refs/tags/v') && github.actor != 'dependabot[bot]' }} + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: centeredge/fakeit + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}},prefix= + type=semver,pattern={{major}}.{{minor}},prefix= + flavor: | + latest=auto + + - name: Docker build + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: ${{ startsWith(github.ref, 'refs/tags/v') }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + annotations: ${{ steps.meta.outputs.annotations }} + provenance: true + sbom: true + cache-to: type=inline + cache-from: type=registry,ref=centeredge/fakeit:main + publish: name: Publish to NPM needs: build-lint-test diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..520ef2b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM node:22-alpine AS build + +WORKDIR /app + +COPY package*.json ./ +RUN npm ci + +COPY app ./app +COPY bin ./bin +COPY babel.config.json ./babel.config.json + +RUN npm run build \ + && npm prune --omit=dev \ + && npm cache clean --force + +FROM node:22-alpine AS runtime + +ENV NODE_ENV=production +WORKDIR /app + +COPY --from=build /app/package.json /app/package-lock.json ./ +COPY --from=build /app/node_modules ./node_modules +COPY --from=build /app/dist ./dist +COPY --from=build /app/bin ./bin + +USER node + +ENTRYPOINT ["node", "/app/bin/fakeit"] +CMD ["--help"] diff --git a/README.md b/README.md index 17d62de..57ab2f4 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,20 @@ npm install @centeredgesoft/fakeit --save-dev npm install @centeredgesoft/fakeit --global ``` +## Docker + +Prebuilt images are published to Docker Hub as [`centeredge/fakeit`](https://hub.docker.com/r/centeredge/fakeit). + +```bash +docker run --rm centeredge/fakeit --help +``` + +To run against local models, mount your working directory: + +```bash +docker run --rm -v "$PWD:/work" -w /work centeredge/fakeit console ./models/*.yaml +``` + ## CLI Usage ```bash From 0b48a72aeee479408c9b38fd81ccb5c2f7474d2d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 21:26:13 +0000 Subject: [PATCH 2/4] Restrict Docker job workflow permissions Agent-Logs-Url: https://github.com/CenterEdge/fakeit/sessions/c5a3ae69-e9cf-4ed9-966f-94cc9c500ff7 Co-authored-by: brantburnett <7118719+brantburnett@users.noreply.github.com> --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef35bf5..31d07ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,8 @@ jobs: name: Docker Build & Publish needs: build-lint-test runs-on: ubuntu-latest + permissions: + contents: read steps: - uses: actions/checkout@v6 From c86bc79c78012530c1b4e36a3bef477f38d15e43 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 21:27:56 +0000 Subject: [PATCH 3/4] Refine Docker workflow metadata and caching Agent-Logs-Url: https://github.com/CenterEdge/fakeit/sessions/c5a3ae69-e9cf-4ed9-966f-94cc9c500ff7 Co-authored-by: brantburnett <7118719+brantburnett@users.noreply.github.com> --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31d07ea..7166573 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,6 +62,7 @@ jobs: uses: docker/metadata-action@v5 with: images: centeredge/fakeit + # Keep semver tags without the leading `v` (e.g. 2.0.0, 2.0). tags: | type=ref,event=branch type=ref,event=pr @@ -81,8 +82,8 @@ jobs: annotations: ${{ steps.meta.outputs.annotations }} provenance: true sbom: true - cache-to: type=inline - cache-from: type=registry,ref=centeredge/fakeit:main + cache-to: type=gha,mode=max + cache-from: type=gha publish: name: Publish to NPM From 335d9567d5bd0bfac8879c14c5ab0e1bd086348f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Apr 2026 12:01:13 +0000 Subject: [PATCH 4/4] Switch Docker image to Node24 and publish to GHCR Agent-Logs-Url: https://github.com/CenterEdge/fakeit/sessions/06566d30-240c-4041-81a2-353bc05062b0 Co-authored-by: brantburnett <7118719+brantburnett@users.noreply.github.com> --- .github/workflows/ci.yml | 10 ++++++---- Dockerfile | 4 ++-- README.md | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7166573..ebd0371 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + packages: write steps: - uses: actions/checkout@v6 @@ -50,18 +51,19 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub + - name: Login to GitHub Container Registry uses: docker/login-action@v3 if: ${{ startsWith(github.ref, 'refs/tags/v') && github.actor != 'dependabot[bot]' }} with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Docker metadata id: meta uses: docker/metadata-action@v5 with: - images: centeredge/fakeit + images: ghcr.io/centeredge/fakeit # Keep semver tags without the leading `v` (e.g. 2.0.0, 2.0). tags: | type=ref,event=branch diff --git a/Dockerfile b/Dockerfile index 520ef2b..5793a3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:22-alpine AS build +FROM node:24-alpine AS build WORKDIR /app @@ -13,7 +13,7 @@ RUN npm run build \ && npm prune --omit=dev \ && npm cache clean --force -FROM node:22-alpine AS runtime +FROM node:24-alpine AS runtime ENV NODE_ENV=production WORKDIR /app diff --git a/README.md b/README.md index 57ab2f4..f1cda3e 100644 --- a/README.md +++ b/README.md @@ -24,16 +24,16 @@ npm install @centeredgesoft/fakeit --global ## Docker -Prebuilt images are published to Docker Hub as [`centeredge/fakeit`](https://hub.docker.com/r/centeredge/fakeit). +Prebuilt images are published to GitHub Container Registry as [`ghcr.io/centeredge/fakeit`](https://github.com/CenterEdge/fakeit/pkgs/container/fakeit). ```bash -docker run --rm centeredge/fakeit --help +docker run --rm ghcr.io/centeredge/fakeit --help ``` To run against local models, mount your working directory: ```bash -docker run --rm -v "$PWD:/work" -w /work centeredge/fakeit console ./models/*.yaml +docker run --rm -v "$PWD:/work" -w /work ghcr.io/centeredge/fakeit console ./models/*.yaml ``` ## CLI Usage