FEATURE: Made Port dynamic with env variable
This commit is contained in:
parent
9e1d7feda5
commit
32a496599f
8 changed files with 19 additions and 8 deletions
1
.env.example
Normal file
1
.env.example
Normal file
|
@ -0,0 +1 @@
|
||||||
|
PORT=3000
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
node_modules
|
node_modules
|
||||||
src/dist
|
src/dist
|
||||||
dev/docker/stacks/main/assets
|
dev/docker/stacks/main/assets
|
||||||
|
.env
|
|
@ -4,10 +4,9 @@ WORKDIR /app
|
||||||
COPY src/ ./src
|
COPY src/ ./src
|
||||||
COPY package.json ./
|
COPY package.json ./
|
||||||
COPY yarn.lock ./
|
COPY yarn.lock ./
|
||||||
|
COPY .env.example ./.env
|
||||||
COPY assets /assets
|
COPY assets /assets
|
||||||
COPY dev/shell/entrypoint.sh /entrypoint.sh
|
COPY dev/shell/entrypoint.sh /entrypoint.sh
|
||||||
RUN yarn
|
RUN yarn && yarn clean && yarn build-prod
|
||||||
RUN yarn clean
|
|
||||||
RUN yarn build-prod
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
|
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
|
|
@ -1,9 +1,11 @@
|
||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: nikurasukun/socialtree
|
image: git.oishi-ra.men/nikurasu/socialtree-js:latest
|
||||||
container_name: socialtree
|
container_name: socialtree
|
||||||
|
environment:
|
||||||
|
PORT: 3000
|
||||||
volumes:
|
volumes:
|
||||||
- ./assets:/app/assets/
|
- ./assets:/app/assets/
|
||||||
ports:
|
ports:
|
||||||
- 80:3000
|
- 3000:3000
|
|
@ -1 +1 @@
|
||||||
docker build -t git.oishi-ra.men/nikurasu/socialtree-js -f dev/docker/images/main/Dockerfile --no-cache .
|
docker build -t git.oishi-ra.men/nikurasu/socialtree-js:latest -f dev/docker/images/main/Dockerfile --no-cache .
|
|
@ -15,6 +15,7 @@
|
||||||
"build-prod": "sass --style=compressed src/public/themes:src/dist/style"
|
"build-prod": "sass --style=compressed src/public/themes:src/dist/style"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"dotenv": "^16.0.3",
|
||||||
"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"
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
import express from 'express'
|
import express from 'express'
|
||||||
import yaml from 'js-yaml'
|
import yaml from 'js-yaml'
|
||||||
import fs from 'node:fs'
|
import fs from 'node:fs'
|
||||||
|
import * as dotenv from 'dotenv'
|
||||||
|
|
||||||
console.log('🔧 Configuring socialtree...')
|
console.log('🔧 Configuring socialtree...')
|
||||||
|
|
||||||
|
dotenv.config()
|
||||||
const app = express()
|
const app = express()
|
||||||
const port = 3000
|
const port = process.env.PORT
|
||||||
const engine = 'ejs'
|
const engine = 'ejs'
|
||||||
|
|
||||||
app.set('view engine', engine)
|
app.set('view engine', engine)
|
||||||
|
|
|
@ -211,6 +211,11 @@ destroy@1.2.0:
|
||||||
resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015"
|
resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015"
|
||||||
integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==
|
integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==
|
||||||
|
|
||||||
|
dotenv@^16.0.3:
|
||||||
|
version "16.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07"
|
||||||
|
integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==
|
||||||
|
|
||||||
ee-first@1.1.1:
|
ee-first@1.1.1:
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
|
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
|
||||||
|
|
Loading…
Reference in a new issue