Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the detection of a single Dockerfile, for the lint stage uses Hadolint to check the Dockerfile syntax and for the build stage tries to build the container
- Loading branch information
1 parent
1be4dad
commit 1c8c5a6
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Introspector } from "../deps.ts"; | ||
|
||
/** | ||
* Introspected information about a project with Docker | ||
*/ | ||
export default interface DockerProject { | ||
hasDockerImage: true; | ||
} | ||
|
||
export const introspector: Introspector<DockerProject> = { | ||
detect: async (context) => { | ||
return await context.files.includes("./Dockerfile"); | ||
}, | ||
introspect: async (context) => { | ||
const logger = await context.getLogger("docker"); | ||
logger.info("Found docker image on root"); | ||
|
||
return { hasDockerImage: true }; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "Dockerfile" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag image:$(date +%s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "Dockerfile" | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: hadolint/hadolint-action@v1.5.0 | ||
with: | ||
dockerfile: Dockerfile |