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

feat: Docker optimizations to improve run time #286

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.git/
node_modules/

*
!package.json
!package-lock.json
!src
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist/
node_modules/

20 changes: 16 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
FROM node:20-alpine AS builder

WORKDIR /action

COPY package.json package-lock.json ./

RUN npm ci

COPY src ./src

RUN npm run build

FROM node:20-alpine

ADD package.json package-lock.json /action/
RUN cd /action && npm ci
WORKDIR /action

COPY --from=builder /action/dist ./dist

ADD src /action/src
ENTRYPOINT ["node", "/action/src/index.js"]
CMD ["./dist/index.js"]
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ inputs:
default: https://www.conventionalcommits.org/en/v1.0.0/#summary
runs:
using: docker
image: Dockerfile
image: docker://ghcr.io/aslafy-z/conventional-pr-title-action
branding:
icon: shield
color: green
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Ensure your PR title matches the Conventional Commits spec.",
"main": "src/index.js",
"scripts": {
"build": "ncc build src/index.js -o dist",
"test": "jest src",
"release": "semantic-release"
},
Expand All @@ -30,6 +31,7 @@
"npm-package-arg": "^10.1.0"
},
"devDependencies": {
"@vercel/ncc": "^0.36.1",
"jest": "29.6.2"
},
"engines": {
Expand Down
1 change: 1 addition & 0 deletions src/installPreset.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = async (preset) => {
const {stdout, stderr} = await exec(`npm install --quiet ${preset}`, {
cwd: path.resolve(__dirname)
});
core.debug(stdout);
core.debug(stderr);
return Promise.resolve();
};