First steps of dockerisation
This commit is contained in:
parent
0b82559f15
commit
d078e20aa3
7 changed files with 50 additions and 7 deletions
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
13
dev/docker/images/main/Dockerfile
Normal file
13
dev/docker/images/main/Dockerfile
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
FROM node:lts-alpine
|
||||||
|
LABEL maintainer="nikurasu_tan publicmail@nikurasu.gay"
|
||||||
|
WORKDIR /app
|
||||||
|
COPY src/ ./src
|
||||||
|
COPY package.json ./
|
||||||
|
COPY yarn.lock ./
|
||||||
|
COPY assets /assets
|
||||||
|
COPY dev/shell/entrypoint.sh /entrypoint.sh
|
||||||
|
RUN yarn
|
||||||
|
RUN yarn clean
|
||||||
|
RUN yarn build-prod
|
||||||
|
EXPOSE 3000
|
||||||
|
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
|
8
dev/shell/entrypoint.sh
Normal file
8
dev/shell/entrypoint.sh
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
if [[ ! -d "/app/assets/config" ]] && [[ ! -d "/app/assets/img" ]]; then
|
||||||
|
echo "No config found, installing default files"
|
||||||
|
cp -R /assets/ /app/assets
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Starting node application"
|
||||||
|
yarn start
|
11
package.json
11
package.json
|
@ -9,17 +9,20 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node src/index.js",
|
"start": "node src/index.js",
|
||||||
"dev": "nodemon src/index.js & $npm_execpath run watch-css",
|
"dev": "nodemon src/index.js & $npm_execpath run watch-css",
|
||||||
|
"clean": "rimraf src/dist",
|
||||||
"watch-css": "run-when-changed --watch 'src/public/themes/*.scss' --watch 'src/public/util/*.scss' --exec '$npm_execpath run build'",
|
"watch-css": "run-when-changed --watch 'src/public/themes/*.scss' --watch 'src/public/util/*.scss' --exec '$npm_execpath run build'",
|
||||||
"build": "sass src/public/themes:src/dist/style & echo \"🎨 Rebuilded your css\""
|
"build": "sass src/public/themes:src/dist/style & echo \"🎨 Rebuilded your css\"",
|
||||||
|
"build-prod": "sass --style=compressed src/public/themes:src/dist/style"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ejs": "^3.1.8",
|
"ejs": "^3.1.8",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0"
|
||||||
"sass": "^1.55.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodemon": "^2.0.20",
|
"nodemon": "^2.0.20",
|
||||||
"run-when-changed": "^2.1.0"
|
"rimraf": "^3.0.2",
|
||||||
|
"run-when-changed": "^2.1.0",
|
||||||
|
"sass": "^1.55.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,10 @@ const engine = 'ejs'
|
||||||
app.set('view engine', engine)
|
app.set('view engine', engine)
|
||||||
app.set('views', './src/views')
|
app.set('views', './src/views')
|
||||||
app.use(express.static('src/dist'))
|
app.use(express.static('src/dist'))
|
||||||
app.use(express.static('src/assets'))
|
app.use(express.static('assets'))
|
||||||
|
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
let config = yaml.load(fs.readFileSync('config/config.yml'), 'utf8')
|
let config = yaml.load(fs.readFileSync('assets/config/config.yml'), 'utf8')
|
||||||
res.render('index', {
|
res.render('index', {
|
||||||
name: config.name,
|
name: config.name,
|
||||||
filenameProfilePic: config.profilePic ? config.profilePic : 'profilepic.jpg',
|
filenameProfilePic: config.profilePic ? config.profilePic : 'profilepic.jpg',
|
||||||
|
|
21
yarn.lock
21
yarn.lock
|
@ -362,6 +362,18 @@ glob-parent@~5.1.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
is-glob "^4.0.1"
|
is-glob "^4.0.1"
|
||||||
|
|
||||||
|
glob@^7.1.3:
|
||||||
|
version "7.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
|
||||||
|
integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==
|
||||||
|
dependencies:
|
||||||
|
fs.realpath "^1.0.0"
|
||||||
|
inflight "^1.0.4"
|
||||||
|
inherits "2"
|
||||||
|
minimatch "^3.1.1"
|
||||||
|
once "^1.3.0"
|
||||||
|
path-is-absolute "^1.0.0"
|
||||||
|
|
||||||
glob@~7.1.1:
|
glob@~7.1.1:
|
||||||
version "7.1.7"
|
version "7.1.7"
|
||||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90"
|
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90"
|
||||||
|
@ -529,7 +541,7 @@ mime@1.6.0:
|
||||||
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
|
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
|
||||||
integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==
|
integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==
|
||||||
|
|
||||||
minimatch@^3.0.4, minimatch@^3.1.2:
|
minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2:
|
||||||
version "3.1.2"
|
version "3.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
|
||||||
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
|
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
|
||||||
|
@ -674,6 +686,13 @@ readdirp@~3.6.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
picomatch "^2.2.1"
|
picomatch "^2.2.1"
|
||||||
|
|
||||||
|
rimraf@^3.0.2:
|
||||||
|
version "3.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a"
|
||||||
|
integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==
|
||||||
|
dependencies:
|
||||||
|
glob "^7.1.3"
|
||||||
|
|
||||||
run-when-changed@^2.1.0:
|
run-when-changed@^2.1.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/run-when-changed/-/run-when-changed-2.1.0.tgz#2e76d6ff6014d38786a3a11b98e9291c7e934953"
|
resolved "https://registry.yarnpkg.com/run-when-changed/-/run-when-changed-2.1.0.tgz#2e76d6ff6014d38786a3a11b98e9291c7e934953"
|
||||||
|
|
Loading…
Reference in a new issue