Skip to content

Commit d34c018

Browse files
authored
Basic Docker Support (nmelhado#84)
* 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
1 parent a585ec1 commit d34c018

9 files changed

+344
-53
lines changed

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copied in from: https://nodejs.org/en/docs/guides/nodejs-docker-webapp/#dockerignore-file
2+
node_modules
3+
npm-debug.log

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ node_modules
55
.env
66
static/smui-dark.css
77
static/smui.css
8+
build

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

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

5+
## [1.2.6] - 2021-10-07
6+
7+
### Added
8+
9+
- Docker support to address feature request [#68](https://github.com/nmelhado/league-page/issues/68)
10+
- Big thank you to [1600dolo](https://github.com/1600dolo) for implementing this
11+
- **WARNING:** This might cause merge conflicts in `package-lock.json`. Going forward shouldn't happen again.
12+
- 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)
13+
514
## [1.2.5] - 2021-09-27
615

716
### Fixed

Dockerfile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM node:14-alpine
2+
3+
WORKDIR /app
4+
5+
# Install required deps
6+
COPY package.json package-lock.json ./
7+
RUN npm ci
8+
9+
# Copy in source and build the app
10+
COPY . .
11+
RUN npm run build-docker
12+
13+
EXPOSE 3000
14+
15+
# Wrap Node.js with Tini since it wasn't designed to be run as PID 1
16+
# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals
17+
RUN apk add --no-cache tini
18+
ENTRYPOINT ["tini", "--"]
19+
CMD ["node", "./build"]

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,15 @@ Generate a custom league page for your Sleeper fantasy football league in just a
9292
npm install
9393
npm run dev --
9494
npm run dev -- --host (to test on other devices locally)
95+
96+
## For local developing with a container
97+
98+
npm run docker-run
99+
95100
## To deploy on [Vercel](https://vercel.com/) for free:
96101
- Push up your changes
97102
- [Link your github repo to Vercel](https://vercel.com/guides/deploying-svelte-with-vercel#step-2:-deploying-your-svelte-app-with-vercel)
98103
- That's it!
99104

100105
<!-- ## Development
101-
see [CONTRIBUTING.md](.github/CONTRIBUTING.md) -->
106+
see [CONTRIBUTING.md](.github/CONTRIBUTING.md) -->

0 commit comments

Comments
 (0)