Skip to content

Commit

Permalink
Basic Docker Support (#84)
Browse files Browse the repository at this point in the history
* Add and use adapter-node for docker builds

* Docker build and run support

* Ignore build dir

* npm install to sync package-lock.json

* Command for local docker run
  • Loading branch information
1600dolo authored Oct 7, 2021
1 parent a585ec1 commit d34c018
Show file tree
Hide file tree
Showing 9 changed files with 344 additions and 53 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copied in from: https://nodejs.org/en/docs/guides/nodejs-docker-webapp/#dockerignore-file
node_modules
npm-debug.log
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
.env
static/smui-dark.css
static/smui.css
build
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file.

## [1.2.6] - 2021-10-07

### Added

- Docker support to address feature request [#68](https://github.com/nmelhado/league-page/issues/68)
- Big thank you to [1600dolo](https://github.com/1600dolo) for implementing this
- **WARNING:** This might cause merge conflicts in `package-lock.json`. Going forward shouldn't happen again.
- Follow these instructions to [resolve the conflict](https://docs.github.com/en/github/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-on-github). For the most part, you'll most likely want to keep the changes from master (the second change)

## [1.2.5] - 2021-09-27

### Fixed
Expand Down
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:14-alpine

WORKDIR /app

# Install required deps
COPY package.json package-lock.json ./
RUN npm ci

# Copy in source and build the app
COPY . .
RUN npm run build-docker

EXPOSE 3000

# Wrap Node.js with Tini since it wasn't designed to be run as PID 1
# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals
RUN apk add --no-cache tini
ENTRYPOINT ["tini", "--"]
CMD ["node", "./build"]
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,15 @@ Generate a custom league page for your Sleeper fantasy football league in just a
npm install
npm run dev --
npm run dev -- --host (to test on other devices locally)

## For local developing with a container

npm run docker-run

## To deploy on [Vercel](https://vercel.com/) for free:
- Push up your changes
- [Link your github repo to Vercel](https://vercel.com/guides/deploying-svelte-with-vercel#step-2:-deploying-your-svelte-app-with-vercel)
- That's it!

<!-- ## Development
see [CONTRIBUTING.md](.github/CONTRIBUTING.md) -->
see [CONTRIBUTING.md](.github/CONTRIBUTING.md) -->
Loading

0 comments on commit d34c018

Please sign in to comment.