Skip to content

Commit

Permalink
Merge pull request #524 from protofire/add-docker-image
Browse files Browse the repository at this point in the history
Add docker image
  • Loading branch information
dbale-altoros authored Dec 5, 2023
2 parents a11b89a + cd58dc9 commit ebe2ec4
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .github/workflows/DOCKER.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Docker Image CI

on:
workflow_dispatch:
inputs:
version:
description: 'solhint version'
required: true
image_name:
description: 'Name of image to be used on docker hub'
required: true
default: 'protofire/solhint'
jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Login to Docker Hub
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Build Docker image
run: docker build . --file docker/Dockerfile --tag ${{ inputs.image_name }}:${{ inputs.version }} --build-arg VERSION=${{ inputs.version }}

- name: Push Docker image to Docker Hub
run: docker push ${{ inputs.image_name }}:${{ inputs.version }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ antlr4.jar
/docs/.sass-cache/
_temp/
*solhintReport*.*
.env
**/.DS_Store

5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,11 @@ Or disable all validations for a group of lines:
### Best Practices Rules
[Full list with all supported Best Practices Rules](docs/rules.md#best-practise-rules)

## Documentation
## Docker
### Solhint has an official Docker Image
Go to docker folder and follow [this](docker/docker.md) instructions.

## Documentation
Related documentation you may find [here](https://protofire.github.io/solhint/).

## IDE Integrations
Expand Down
5 changes: 5 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM node:20-alpine
LABEL maintainer="[email protected]"
ENV VERSION=4.0.0

RUN npm install -g solhint@"$VERSION"
27 changes: 27 additions & 0 deletions docker/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Docker Instructions
Thanks [@keypee](https://github.com/kaypee90) for the contribution<br><br>

1. Get the image. Run:<br>
`docker pull protodb/protofire-solhint:latest`

2. Check if image is present (protodb/protofire-solhint:latest)<br>
`docker images`

3. Solhint use:<br>

- Execute solhint with default config file<br>
`docker run -v ./:/app -w /app -it protodb/protofire-solhint solhint './contracts/*.sol'`

This command:<br>
- Maps current folder to app/ inside container <br>
- Executes solhint in './contracts/*.sol'<br>

- Navigate inside container sharing current folder into app/ container folder<br>
`docker run -v ./:/app -w /app -it protodb/protofire-solhint /bin/sh`<br>

This command:<br>
- Maps current folder to app/ container folder<br>
- Can run solhint inside the container by typping `solhint ./contracts/*.sol`<br>
(use your correct path, type exit to finish)<br>


0 comments on commit ebe2ec4

Please sign in to comment.