Skip to content

Commit

Permalink
add a Dockerfile for local viewing without install
Browse files Browse the repository at this point in the history
  • Loading branch information
ndp committed Jul 18, 2024
1 parent e5a690c commit 9a300bc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:20-alpine
RUN corepack enable
WORKDIR /app
COPY . .
RUN yarn install
EXPOSE 8080
CMD ["yarn", "start"]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ Keep the PR restricted to changes related to the translation.
## Development

Files are in the `src` folder. To see it locally:
- `yarn install` to install dependencies
- `yarn test` to run the tests
- `yarn build` to transpile.
- `yarn start` to serve
- `yarn start` or `yarn start-docker` to serve. The latter uses a Docker container.
- Open `http://127.0.0.1:8080/git-cheatsheet.html` to view the page

CI is on [Github Actions](https://github.com/ndp/git-cheatsheet/actions).
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
"build": "yarn build-js && yarn build-styles",
"build-js": "webpack --entry ./src/git-cheatsheet.js -o ./git-cheatsheet/ --mode production --target browserslist --devtool source-map",
"build-styles": "node ./src/build-styles.js",
"docker-build": "docker build -t git-cheatsheet .",
"docker-run": "docker run -p 8080:8080 git-cheatsheet",
"clean": "rm -f git-cheatsheet/*.map git-cheatsheet/*.js ./git-cheatsheet/styles.css",
"test": "jasmine spec/*_spec.mjs",
"start": "npx http-server"
"start": "npx http-server",
"start-docker": "npm run docker-build && npm run docker-run"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 9a300bc

Please sign in to comment.