Compare commits
2 Commits
737b79eb5d
...
aa5ef10e85
Author | SHA1 | Date | |
---|---|---|---|
aa5ef10e85 | |||
ccdfd2513f |
@ -5,6 +5,7 @@
|
|||||||
!*.js
|
!*.js
|
||||||
!*.sh
|
!*.sh
|
||||||
!*.md
|
!*.md
|
||||||
|
!.env
|
||||||
!config
|
!config
|
||||||
config/local.json
|
config/local.json
|
||||||
!client
|
!client
|
||||||
|
13
Dockerfile
13
Dockerfile
@ -29,14 +29,21 @@ FROM base AS production
|
|||||||
RUN DEBIAN_FRONTEND=NONINTERACTIVE apt-get install -y \
|
RUN DEBIAN_FRONTEND=NONINTERACTIVE apt-get install -y \
|
||||||
git
|
git
|
||||||
|
|
||||||
|
# Not sure if the root is actually used for anything...
|
||||||
WORKDIR /website
|
WORKDIR /website
|
||||||
COPY /package.json /website/
|
COPY /package.json /website/
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY /.babelrc /*.html /*.js /website/
|
COPY /.babelrc /*.html /*.js /website/
|
||||||
COPY /src /website/src
|
COPY /src /website/src
|
||||||
COPY /frontend /website/frontend
|
COPY /.env /website/
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
# Polymer frontend app built using bower
|
||||||
|
WORKDIR /website/frontend
|
||||||
|
COPY /frontend /website/frontend
|
||||||
|
RUN npx -y bower -y install
|
||||||
|
|
||||||
|
# 'identities' frontend built using react
|
||||||
WORKDIR /website/client
|
WORKDIR /website/client
|
||||||
COPY /client/package.json /website/client/
|
COPY /client/package.json /website/client/
|
||||||
RUN npm install
|
RUN npm install
|
||||||
@ -44,6 +51,7 @@ COPY /client/tsconfig.json /website/client/
|
|||||||
COPY /client/*.js /website/client/
|
COPY /client/*.js /website/client/
|
||||||
COPY /client/public /website/client/public
|
COPY /client/public /website/client/public
|
||||||
COPY /client/src /website/client/src
|
COPY /client/src /website/client/src
|
||||||
|
COPY /client/.env /website/client/
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -81,6 +89,7 @@ WORKDIR /website/server
|
|||||||
COPY /server/package.json /website/server/
|
COPY /server/package.json /website/server/
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
|
COPY /.env /website/
|
||||||
COPY /config /website/config
|
COPY /config /website/config
|
||||||
COPY /server/*.js /website/server/
|
COPY /server/*.js /website/server/
|
||||||
COPY /server/db /website/server/db
|
COPY /server/db /website/server/db
|
||||||
@ -96,7 +105,7 @@ COPY /ketrface /website/ketrface
|
|||||||
FROM runtime AS website
|
FROM runtime AS website
|
||||||
RUN echo "Building PRODUCTION"
|
RUN echo "Building PRODUCTION"
|
||||||
COPY /server/production.location /etc/nginx/snippets/active.location
|
COPY /server/production.location /etc/nginx/snippets/active.location
|
||||||
COPY /frontend /website/frontend
|
COPY --from=production /frontend /website/frontend
|
||||||
COPY --from=production /website/dist /website/dist
|
COPY --from=production /website/dist /website/dist
|
||||||
COPY --from=production /website/*.html /website/
|
COPY --from=production /website/*.html /website/
|
||||||
COPY --from=production /website/client/build /website/client/build
|
COPY --from=production /website/client/build /website/client/build
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
fail() {
|
||||||
|
echo "$*" >&2
|
||||||
|
exit -1
|
||||||
|
}
|
||||||
|
|
||||||
if [[ "${TARGET_PORT}" != "" ]]; then
|
if [[ "${TARGET_PORT}" != "" ]]; then
|
||||||
sed -i -e "s,8123,${TARGET_PORT},g" /etc/nginx/sites-enabled/default
|
sed -i -e "s,8123,${TARGET_PORT},g" /etc/nginx/sites-enabled/default
|
||||||
@ -26,6 +30,24 @@ if [[ -z "${DEVELOPMENT}" ]]; then
|
|||||||
{ while true; do npm start ; sleep 3 ; done ; }
|
{ while true; do npm start ; sleep 3 ; done ; }
|
||||||
else
|
else
|
||||||
echo "Running in DEVELOPMENT mode."
|
echo "Running in DEVELOPMENT mode."
|
||||||
|
if [[ -d /website/frontend/bower_components ]]; then
|
||||||
|
cd /website/frontend
|
||||||
|
npm install &&
|
||||||
|
npx bower install || fail "Unable to install frontend"
|
||||||
|
fi
|
||||||
|
if [[ -d /website/client/node_modules ]]; then
|
||||||
|
cd /website/client
|
||||||
|
npm install || fail "Unable to install client"
|
||||||
|
fi
|
||||||
|
if [[ -d /website/node_modules ]]; then
|
||||||
|
cd /website
|
||||||
|
npm install || fail "Unable to install website"
|
||||||
|
fi
|
||||||
|
if [[ -d /website/server/node_modules ]]; then
|
||||||
|
cd /website/server
|
||||||
|
npm install || fail "Unable to install server"
|
||||||
|
fi
|
||||||
|
|
||||||
cd /website/server
|
cd /website/server
|
||||||
{ while true; do npm start ; sleep 3 ; done ; } &
|
{ while true; do npm start ; sleep 3 ; done ; } &
|
||||||
cd /website/client
|
cd /website/client
|
||||||
|
@ -91,8 +91,17 @@ app.use(function(req, res, next){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const dbPath = { ...config.get("sessions.db") };
|
||||||
|
let configPath = process.env.NODE_CONFIG_DIR;
|
||||||
|
if (configPath) {
|
||||||
|
configPath = configPath.replace(/config/, '');
|
||||||
|
} else {
|
||||||
|
configPath = './'
|
||||||
|
}
|
||||||
|
dbPath = `${configPath}${dbPath}`;
|
||||||
|
|
||||||
app.use(session({
|
app.use(session({
|
||||||
store: new SQLiteStore({ db: config.get("sessions.db") }),
|
store: new SQLiteStore({ db: dbPath }),
|
||||||
secret: config.get("sessions.store-secret"),
|
secret: config.get("sessions.store-secret"),
|
||||||
cookie: { maxAge: 7 * 24 * 60 * 60 * 1000 }, // 1 week
|
cookie: { maxAge: 7 * 24 * 60 * 60 * 1000 }, // 1 week
|
||||||
saveUninitialized: false,
|
saveUninitialized: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user