Compare commits

..

No commits in common. "05c39487d8a32e5cabce731f39fdab28c1397a99" and "0da9c4f88f710b74f7cff5d616a4610dc65f1854" have entirely different histories.

3 changed files with 32 additions and 1 deletions

View File

@ -4,4 +4,7 @@ WORKDIR /opt/code
COPY . /opt/code COPY . /opt/code
RUN rm -rf node_modules package-lock.json yarn.lock && \
./install
CMD [ "npm", "run", "dev" ] CMD [ "npm", "run", "dev" ]

View File

@ -4,4 +4,7 @@ WORKDIR /opt/code
COPY . /opt/code COPY . /opt/code
RUN rm -rf node_modules package-lock.json yarn.lock && \
./install
CMD [ "npm", "run", "prod" ] CMD [ "npm", "run", "prod" ]

View File

@ -2,6 +2,8 @@ console.log('Executing startup jobs...');
const fs = require('fs'); const fs = require('fs');
const { crc32 } = require('easy-crc'); const { crc32 } = require('easy-crc');
const glob = require('glob');
const { exec } = require('child_process');
const hrt = () => { const hrt = () => {
let hr = process.hrtime(); let hr = process.hrtime();
@ -27,13 +29,36 @@ if (process.env.APP_DEBUG == 'true') {
// build resume page // build resume page
if ((!fs.existsSync('public/static/dist/resume.js')) && (!process.env.APP_DEBUG)) { if ((!fs.existsSync('public/static/dist/resume.js')) && (!process.env.APP_DEBUG)) {
console.log('Resume files do not exist!'); console.log('Resume files do not exist, building it automatically...');
exec('react/resume/build.sh');
} }
// load key // load key
if (!process.env.APP_KEY) if (!process.env.APP_KEY)
throw new Error('APP_KEY is not set.') throw new Error('APP_KEY is not set.')
// import gpg keys
glob('data/userdata/*_gpgkey', async (err, files) => {
if (err) {
console.error(err);
process.exit(-1);
}
files.filter(
file => {
return !file.startsWith('.')
}
).forEach(file => {
exec('gpg --import ' + file, (err, stdout, stderr) => {
if (err) {
console.error(`Errors while importing ${file}: ${err}`);
process.exit(-1);
}
console.log(`Imported ${file} key`);
});
});
});
console.log('Using a key with CRC32: ' + crc32('CRC-32', process.env.APP_KEY)); console.log('Using a key with CRC32: ' + crc32('CRC-32', process.env.APP_KEY));
async function startup() { async function startup() {