Skip to content

Commit

Permalink
feat: add docker stack
Browse files Browse the repository at this point in the history
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
joao10lima committed Sep 8, 2021
1 parent 1be4dad commit 1c8c5a6
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
20 changes: 20 additions & 0 deletions core/plugins/stack/docker/mod.ts
@@ -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 };
},
};
15 changes: 15 additions & 0 deletions core/templates/github/docker/build.yml
@@ -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)
16 changes: 16 additions & 0 deletions core/templates/github/docker/lint.yml
@@ -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

0 comments on commit 1c8c5a6

Please sign in to comment.