Skip to content

Commit

Permalink
feat(CICD): add docker linter
Browse files Browse the repository at this point in the history
  • Loading branch information
panpuchkov committed Dec 23, 2023
1 parent 8ec595c commit 6c94845
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions: write-all
- main
env:
IMAGE_NAME: 'pygitver'
REGISTRY_NAME: pygitver
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}

jobs:
unittests:
Expand All @@ -33,25 +33,33 @@ jobs:
build:
runs-on: ubuntu-latest
needs: unittests
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3

- name: Dockerfile lint
if: ${{ env.IMAGE_EXIST == 'false' }}
id: validate-dockerfile
shell: bash
run: |
docker run --rm -e HADOLINT_IGNORE=DL3007,DL3008,DL3018,DL4006,DL3013 -i hadolint/hadolint < Dockerfile
- name: Docker Build
shell: bash
run: |
set -x
docker build -t "panpuchkov/${{ env.IMAGE_NAME }}" .
docker build -t "${{ env.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}" .
- name: Log in to Docker Hub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
username: panpuchkov
username: ${{ env.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker Push
if: github.ref == 'refs/heads/main'
shell: bash
run: |
set -x
IMAGE_NAME_WITH_VERSION="panpuchkov/${{ env.IMAGE_NAME }}:latest"
IMAGE_NAME_WITH_VERSION="${{ env.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest"
docker push "${IMAGE_NAME_WITH_VERSION}"
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ ENV PATH="/opt/venv/bin:$PATH"

# Install pip requirements
COPY ./requirements.txt /pygitver/requirements.txt
RUN pip install -U pip \
&& pip install -r /pygitver/requirements.txt --no-cache-dir
RUN pip install --no-cache-dir -U pip \
&& pip install --no-cache-dir -r /pygitver/requirements.txt

FROM python:3.12-alpine

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Semver-Helper
# pygitver

Features:
* Conventional Commit linter
Expand Down Expand Up @@ -48,7 +48,7 @@ feat(lang): add Polish language
## Users (Developers) Section


### Install Semver-Helper
### Install pygitver
Run in the `git` root folder of the target repository on localhost.
```shell
docker run --rm -v $(pwd):/app -w /app --entrypoint '' panpuchkov/pygitver /pygitver/scripts/install.sh
Expand All @@ -57,7 +57,7 @@ docker run --rm -v $(pwd):/app -w /app --entrypoint '' panpuchkov/pygitver /pygi
* It doesn't matter what the current branch is.
* You should install it in every repository that needs conventional commit messages.

### Update Semver-Helper
### Update pygitver

Run in terminal in any folder:

Expand Down

0 comments on commit 6c94845

Please sign in to comment.