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

Docker support #131

Merged
merged 4 commits into from
Oct 3, 2022
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
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dist/
node_modules/
*.log
.idea/
.github/
.vscode/
.gitignore/
Dockerfile
.dockerignore
nodemon.json
sample/
30 changes: 22 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ on:
- main

jobs:
build:
name: Build and test
runs-on: ubuntu-18.04
npm-build:
name: "node: Build and test"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3

- name: Use Node.js 14-latest
uses: actions/setup-node@v1
- name: Use Node.js 18-latest
uses: actions/setup-node@v3
with:
node-version: '14.x'
node-version: 18

- name: Cache node_modules
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: node_modules
key: yarn-${{ hashFiles('yarn.lock') }}
Expand All @@ -33,3 +33,17 @@ jobs:
- run: yarn test --ci

- run: yarn build

docker-build:
name: "docker: Build"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Build
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: false
63 changes: 59 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ jobs:
exit 1
fi

- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: '14.x'
node-version: 18
always-auth: true
registry-url: https://registry.npmjs.org/

- name: Cache node_modules
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: node_modules
key: yarn-${{ hashFiles('yarn.lock') }}
Expand All @@ -41,3 +41,58 @@ jobs:
run: yarn publish --access public --new-version ${{ env.VERSION }} --no-git-tag-version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}


publish-docker:
env:
VERSION: ${{ github.event.release.tag_name }}
IMAGE_NAME: encx/codecoach-cli

runs-on: ubuntu-latest

steps:
- name: Version ${{ env.VERSION }} validity check
run: |
if [ $(npm info codecoach@^${{ env.VERSION }} | wc -c) -gt 0 ]; then
echo "Release version must be greater than existing released versions."
exit 1
fi

- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

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

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},value=${{ env.VERSION }}
type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }}
type=semver,pattern={{major}},value=${{ env.VERSION }}
type=ref,event=pr
labels: |
org.opencontainers.image.title=CodeCoach
org.opencontainers.image.description=Automated code review tool
org.opencontainers.image.licenses=MIT

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Loading