Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
fix(ci): optimize dockerfile and lint tsc only on staged files (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgfr authored Oct 11, 2022
1 parent 8e5cea3 commit 6219c1f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ README.md
.next
.kube-workflow
.github
.git
.DS_Store
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ ENV NEXT_PUBLIC_HASURA_GRAPHQL_ENDPOINT_URL $NEXT_PUBLIC_HASURA_GRAPHQL_ENDPOINT

WORKDIR /app

COPY package.json yarn.lock /app/
COPY package.json .

COPY yarn.lock .

RUN yarn install --frozen-lockfile

COPY . .

RUN yarn install --frozen-lockfile && yarn build && yarn install --production && if [ -z "$NEXT_PUBLIC_IS_PRODUCTION_DEPLOYMENT" ]; then echo "Copy staging values"; cp .env.staging .env.production; fi
RUN yarn build && \
yarn install --production && \
yarn cache clean && \
if [ -z "$NEXT_PUBLIC_IS_PRODUCTION_DEPLOYMENT" ]; then echo "Copy staging values"; cp .env.staging .env.production; fi

# Runner
FROM node:$NODE_VERSION AS runner
Expand Down
5 changes: 4 additions & 1 deletion lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const buildEslintCommand = filenames =>
.join(" --file ")}`;

module.exports = {
"**/*.ts?(x)": () => "tsc -p tsconfig.json --noEmit",
"**/*.ts?(x)": filenames =>
`tsc-files -p tsconfig.json --noEmit ${filenames
.map(fN => `"${fN}"`)
.join(" ")}`,
"*.{js,ts,tsx,jsx}": ["jest --bail --findRelatedTests", buildEslintCommand],
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"lint-staged": "^12.3.7",
"node-talisman": "^1.28.0",
"start-server-and-test": "^1.14.0",
"tsc-files": "^1.1.3",
"typescript": "4.8.4"
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12537,6 +12537,11 @@ ts-pnp@^1.1.6:
resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92"
integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==

tsc-files@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/tsc-files/-/tsc-files-1.1.3.tgz#ef4cfcb7affc9b90577d707a879dc53bb105be83"
integrity sha512-G6uXkTNofGU9EE1fYBaCpR72x/aqXW4PDAuznWj4JYlDwhcaKnUn4CiCHBMc89lDxLmikK+hhaEWLoTPEKKvXg==

tsconfig-paths@^3.14.1:
version "3.14.1"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz#ba0734599e8ea36c862798e920bcf163277b137a"
Expand Down

0 comments on commit 6219c1f

Please sign in to comment.