-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into fix-parse-secret-…
…containing-equal-character # Conflicts: # __tests__/buildx.test.ts
- Loading branch information
Showing
7 changed files
with
143 additions
and
5 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 @@ | ||
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 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,52 @@ | ||
#syntax=docker/dockerfile:1.1-experimental | ||
|
||
FROM node:12 AS deps | ||
WORKDIR /src | ||
COPY package.json yarn.lock ./ | ||
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn \ | ||
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 yarn build | ||
|
||
FROM deps AS test | ||
COPY --from=docker /usr/local/bin/docker /usr/bin/ | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG BUILDX_VERSION=v0.4.2 | ||
ENV RUNNER_TEMP=/tmp/github_runner | ||
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache | ||
RUN mkdir -p /usr/local/lib/docker/cli-plugins && \ | ||
curl -fsSL https://github.com/docker/buildx/releases/download/$BUILDX_VERSION/buildx-$BUILDX_VERSION.$TARGETOS-$TARGETARCH > /usr/local/lib/docker/cli-plugins/docker-buildx && \ | ||
chmod +x /usr/local/lib/docker/cli-plugins/docker-buildx && \ | ||
docker buildx version | ||
COPY . . | ||
RUN yarn run test | ||
|
||
FROM base AS run-format | ||
RUN yarn run format | ||
|
||
FROM scratch AS format | ||
COPY --from=run-format /src/src/*.ts /src/ | ||
|
||
FROM base AS validate-format | ||
RUN 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
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,42 @@ | ||
group "default" { | ||
targets = ["build"] | ||
} | ||
|
||
group "pre-checkin" { | ||
targets = ["update-yarn", "format", "build"] | ||
} | ||
|
||
group "validate" { | ||
targets = ["validate-format", "validate-build", "validate-yarn"] | ||
} | ||
|
||
target "update-yarn" { | ||
target = "update-yarn" | ||
output = ["."] | ||
} | ||
|
||
target "build" { | ||
target = "dist" | ||
output = ["."] | ||
} | ||
|
||
target "test" { | ||
target = "test" | ||
} | ||
|
||
target "format" { | ||
target = "format" | ||
output = ["."] | ||
} | ||
|
||
target "validate-format" { | ||
target = "validate-format" | ||
} | ||
|
||
target "validate-build" { | ||
target = "validate-build" | ||
} | ||
|
||
target "validate-yarn" { | ||
target = "validate-yarn" | ||
} |
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,7 @@ | ||
import * as exec from './exec'; | ||
|
||
export async function isDaemonRunning(): Promise<boolean> { | ||
return await exec.exec(`docker`, ['version', '--format', '{{.Server.Os}}'], true).then(res => { | ||
return !res.stdout.includes(' ') && res.success; | ||
}); | ||
} |