mirror of
https://github.com/Wolvan/poll.horse.git
synced 2024-11-21 20:47:59 +01:00
Dockerize Application
Now poll.horse is available as a docker image! To persist data, mount `/data` to a host directory. A config file can be specified via binding `/usr/src/app/config.json` to a config file on the host.
This commit is contained in:
parent
afe6da1ae4
commit
d34c50c8f1
4 changed files with 100 additions and 0 deletions
33
.dockerignore
Normal file
33
.dockerignore
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
**/.classpath
|
||||||
|
**/.dockerignore
|
||||||
|
**/.env
|
||||||
|
**/.git
|
||||||
|
**/.gitignore
|
||||||
|
**/.project
|
||||||
|
**/.settings
|
||||||
|
**/.toolstarget
|
||||||
|
**/.vs
|
||||||
|
**/.vscode
|
||||||
|
**/*.*proj.user
|
||||||
|
**/*.dbmdl
|
||||||
|
**/*.jfm
|
||||||
|
**/charts
|
||||||
|
**/docker-compose*
|
||||||
|
**/compose*
|
||||||
|
**/Dockerfile*
|
||||||
|
**/node_modules
|
||||||
|
**/npm-debug.log
|
||||||
|
**/obj
|
||||||
|
**/secrets.dev.yaml
|
||||||
|
**/values.dev.yaml
|
||||||
|
README.md
|
||||||
|
CHANGELOG.md
|
||||||
|
API.md
|
||||||
|
LICENSE
|
||||||
|
|
||||||
|
data/
|
||||||
|
dist/
|
||||||
|
node_modules/
|
||||||
|
.editorconfig
|
||||||
|
config*.js*
|
||||||
|
Procfile
|
7
.vscode/launch.json
vendored
7
.vscode/launch.json
vendored
|
@ -13,6 +13,13 @@
|
||||||
],
|
],
|
||||||
"restart": true,
|
"restart": true,
|
||||||
"type": "pwa-node"
|
"type": "pwa-node"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Docker Node.js Launch",
|
||||||
|
"type": "docker",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "docker-run: debug",
|
||||||
|
"platform": "node"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
39
.vscode/tasks.json
vendored
Normal file
39
.vscode/tasks.json
vendored
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "docker-build",
|
||||||
|
"label": "docker-build",
|
||||||
|
"platform": "node",
|
||||||
|
"dockerBuild": {
|
||||||
|
"dockerfile": "${workspaceFolder}/Dockerfile",
|
||||||
|
"context": "${workspaceFolder}",
|
||||||
|
"pull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "docker-run",
|
||||||
|
"label": "docker-run: release",
|
||||||
|
"dependsOn": [
|
||||||
|
"docker-build"
|
||||||
|
],
|
||||||
|
"platform": "node"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "docker-run",
|
||||||
|
"label": "docker-run: debug",
|
||||||
|
"dependsOn": [
|
||||||
|
"docker-build"
|
||||||
|
],
|
||||||
|
"dockerRun": {
|
||||||
|
"env": {
|
||||||
|
"DEBUG": "*",
|
||||||
|
"NODE_ENV": "development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node": {
|
||||||
|
"enableDebugging": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
21
Dockerfile
Normal file
21
Dockerfile
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
FROM node:lts-alpine
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
# Add Tini
|
||||||
|
RUN apk add --update tini
|
||||||
|
|
||||||
|
# Install and build application
|
||||||
|
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
|
||||||
|
RUN npm set-script prepublish ""
|
||||||
|
RUN npm install --silent && npm cache clean --silent --force
|
||||||
|
COPY . .
|
||||||
|
RUN npm test
|
||||||
|
RUN npm run build
|
||||||
|
RUN rm -rf src utils .eslintignore .eslintrc.json .mocharc.json test tsconfig.json
|
||||||
|
RUN npm prune --production --silent
|
||||||
|
RUN chown -R node /usr/src/app
|
||||||
|
RUN mv node_modules ../
|
||||||
|
ENV PORT=6969
|
||||||
|
RUN mkdir -p /data && chown -R node /data
|
||||||
|
USER node
|
||||||
|
ENTRYPOINT ["/sbin/tini", "--", "node", "dist/main", "--port", "env:PORT", "--data-directory", "/data"]
|
Loading…
Reference in a new issue