-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Container based developer flow (#103)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
129 additions
and
54 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 |
---|---|---|
@@ -1,13 +1,4 @@ | ||
.git | ||
.github | ||
.res | ||
lib | ||
node_modules | ||
src | ||
.editorconfig | ||
.gitignore | ||
.prettierrc.json | ||
action.yml | ||
package.json | ||
package-lock.json | ||
tsconfig.json | ||
/.dev | ||
/dist | ||
/lib | ||
/node_modules |
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
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
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
name: validate | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'releases/v*' | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
branches: | ||
- 'master' | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
validate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Validate | ||
run: docker buildx bake validate |
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,41 @@ | ||
#syntax=docker/dockerfile:1.2 | ||
|
||
FROM node:12 AS deps | ||
WORKDIR /src | ||
COPY package.json yarn.lock ./ | ||
RUN --mount=type=cache,target=/src/node_modules \ | ||
yarn install | ||
|
||
FROM scratch AS update-yarn | ||
COPY --from=deps /src/yarn.lock / | ||
|
||
FROM deps AS validate-yarn | ||
COPY .git .git | ||
RUN status=$(git status --porcelain -- yarn.lock); if [ -n "$status" ]; then echo $status; exit 1; fi | ||
|
||
FROM deps AS base | ||
COPY . . | ||
|
||
FROM base AS build | ||
RUN --mount=type=cache,target=/src/node_modules \ | ||
yarn build | ||
|
||
FROM base AS run-format | ||
RUN --mount=type=cache,target=/src/node_modules \ | ||
yarn run format | ||
|
||
FROM scratch AS format | ||
COPY --from=run-format /src/src/*.ts /src/ | ||
|
||
FROM base AS validate-format | ||
RUN --mount=type=cache,target=/src/node_modules \ | ||
yarn run format-check | ||
|
||
FROM scratch AS dist | ||
COPY --from=build /src/dist/ /dist/ | ||
|
||
FROM build AS validate-build | ||
RUN status=$(git status --porcelain -- dist); if [ -n "$status" ]; then echo $status; exit 1; fi | ||
|
||
FROM base AS dev | ||
ENTRYPOINT ["bash"] |
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,48 @@ | ||
group "default" { | ||
targets = ["build"] | ||
} | ||
|
||
group "pre-checkin" { | ||
targets = ["update-yarn", "format", "build"] | ||
} | ||
|
||
group "validate" { | ||
targets = ["validate-format", "validate-build", "validate-yarn"] | ||
} | ||
|
||
target "dockerfile" { | ||
dockerfile = "Dockerfile.dev" | ||
} | ||
|
||
target "update-yarn" { | ||
inherits = ["dockerfile"] | ||
target = "update-yarn" | ||
output = ["."] | ||
} | ||
|
||
target "build" { | ||
inherits = ["dockerfile"] | ||
target = "dist" | ||
output = ["."] | ||
} | ||
|
||
target "format" { | ||
inherits = ["dockerfile"] | ||
target = "format" | ||
output = ["."] | ||
} | ||
|
||
target "validate-format" { | ||
inherits = ["dockerfile"] | ||
target = "validate-format" | ||
} | ||
|
||
target "validate-build" { | ||
inherits = ["dockerfile"] | ||
target = "validate-build" | ||
} | ||
|
||
target "validate-yarn" { | ||
inherits = ["dockerfile"] | ||
target = "validate-yarn" | ||
} |