Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bbachi committed Oct 24, 2021
1 parent 084acd3 commit 84a6505
Show file tree
Hide file tree
Showing 15 changed files with 645 additions and 127 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ RUN cd my-app && npm install && npm run build

FROM node:10 AS server-build
WORKDIR /root/
COPY --from=ui-build /usr/src/app/my-app/build ./my-app/build
COPY --from=ui-build /usr/src/app/my-app/dist ./my-app/dist
COPY api/package*.json ./api/
RUN cd api && npm install
COPY api/server.js ./api/

EXPOSE 3080
EXPOSE 80

CMD ["node", "./api/server.js"]
22 changes: 11 additions & 11 deletions api/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ var exec = require('child_process').exec;
const paths = {
prod_build: '../prod-build',
server_file_name: 'server.bundle.js',
react_src: '../my-app/build/**/*',
react_dist: '../prod-build/my-app/build',
zipped_file_name: 'react-nodejs.zip'
vue_src: '../my-app/dist/**/*',
vue_dist: '../prod-build/my-app/dist',
zipped_file_name: 'vuejs-nodejs.zip'
};

function clean() {
Expand All @@ -32,19 +32,19 @@ function createProdBuildFolder() {
return Promise.resolve('the value is ignored');
}

function buildReactCodeTask(cb) {
log('building React code into the directory')
function buildVueCodeTask(cb) {
log('building Vue code into the directory')
return exec('cd ../my-app && npm run build', function (err, stdout, stderr) {
log(stdout);
log(stderr);
cb(err);
})
}

function copyReactCodeTask() {
log('copying React code into the directory')
return src(`${paths.react_src}`)
.pipe(dest(`${paths.react_dist}`));
function copyVueCodeTask() {
log('copying Vue code into the directory')
return src(`${paths.vue_src}`)
.pipe(dest(`${paths.vue_dist}`));
}

function copyNodeJSCodeTask() {
Expand All @@ -63,7 +63,7 @@ function zippingTask() {
exports.default = series(
clean,
createProdBuildFolder,
buildReactCodeTask,
parallel(copyReactCodeTask, copyNodeJSCodeTask),
buildVueCodeTask,
parallel(copyVueCodeTask, copyNodeJSCodeTask),
zippingTask
);
Loading

0 comments on commit 84a6505

Please sign in to comment.