Skip to content

Commit

Permalink
feat: publish to dockerhub (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
adeherysh authored Apr 18, 2024
1 parent fc97eb3 commit b631cac
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 4 deletions.
39 changes: 37 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,43 @@ jobs:
run: bun run build
if: ${{ steps.release.outputs.release_created }}

- name: Publish package
- name: Publish to npmjs
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_AUTH_TOKEN: ${{secrets.NPMJS_TOKEN}}
if: ${{ steps.release.outputs.release_created }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: kitabisa/smockr
tag-sha: true

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Publish to DockerHub
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: kitabisa/smockr:latest
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}
@kitabisa:registry=https://registry.npmjs.org
always-auth=true
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM oven/bun:1
WORKDIR /usr/src/app

# copy binary files
COPY bin /usr/src/app/
COPY dist /usr/src/app/

# setup env
ENV NODE_ENV=production

# run the app
USER bun
EXPOSE 3000/tcp
ENTRYPOINT [ "bun", "run", "dist/cli.js" ]
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,24 @@ CLI tools for serve supple mock server with random fake data using <a href="http

## Getting Started

Setup smockr
Setup smockr with npm

```
$ npm install -g @kitabisa/smockr
```

Setup smockr with bun

```
$ bun add -g @kitabisa/smockr
```

Setup smockr with docker

```
$ docker pull kitabisa/smockr
```

## Quick Start

Running mock with default params
Expand Down

0 comments on commit b631cac

Please sign in to comment.