get local-ssl-proxy working for testing prod locally
This commit is contained in:
parent
a14c232935
commit
b172087b98
7 changed files with 25 additions and 14 deletions
13
Dockerfile
13
Dockerfile
|
@ -4,21 +4,21 @@ ENV APP_HOME=/usr/src/app \
|
|||
RUN mkdir -p $APP_HOME
|
||||
WORKDIR $APP_HOME
|
||||
EXPOSE 8000
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
FROM base as development
|
||||
ENV NODE_ENV development
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm install
|
||||
RUN npm rebuild node-sass
|
||||
COPY .babelrc index.js nodemon.json webpack.config.babel.js webpack.config.dev.js webpack.config.prod.js webpack.config.server.js ./
|
||||
COPY .babelrc index.js nodemon.json webpack.config.babel.js webpack.config.dev.js webpack.config.prod.js webpack.config.server.js webpack.config.examples.js ./
|
||||
COPY client ./client
|
||||
COPY server ./server
|
||||
COPY scripts ./scripts
|
||||
CMD ["npm", "start"]
|
||||
|
||||
FROM development as build
|
||||
ENV NODE_ENV production
|
||||
# COPY .env ./
|
||||
RUN npm run build
|
||||
|
||||
FROM base as production
|
||||
|
@ -27,8 +27,9 @@ COPY package.json package-lock.json ./
|
|||
RUN npm install --production
|
||||
RUN npm rebuild node-sass
|
||||
RUN npm install pm2 -g
|
||||
COPY index.js ecosystem.json .babelrc ./
|
||||
COPY scripts ./scripts
|
||||
# COPY .env ./
|
||||
RUN npm install local-ssl-proxy
|
||||
COPY index.js ecosystem.json ./
|
||||
COPY --from=build /usr/src/app/dist ./dist
|
||||
RUN npm run ssl-proxy
|
||||
#RUN npm run fetch-examples:prod
|
||||
CMD ["pm2-runtime", "ecosystem.json"]
|
||||
|
|
|
@ -6,8 +6,8 @@ services:
|
|||
- dbdata:/data/db
|
||||
expose:
|
||||
- "27017"
|
||||
nginx:
|
||||
build: ./nginx
|
||||
# nginx:
|
||||
# build: ./nginx
|
||||
server:
|
||||
build:
|
||||
context: .
|
||||
|
@ -17,11 +17,15 @@ services:
|
|||
- .env
|
||||
environment:
|
||||
- MONGO_URL=mongodb://mongo:27017/p5js-web-editor
|
||||
- API_URL=https://localhost/api
|
||||
- PORT=80
|
||||
volumes:
|
||||
- .:/opt/node/app
|
||||
- /opt/node/app/node_modules
|
||||
ports:
|
||||
- '8000:8000'
|
||||
- '80:80'
|
||||
- '443:443'
|
||||
depends_on:
|
||||
- mongo
|
||||
volumes:
|
||||
|
|
|
@ -8,12 +8,16 @@
|
|||
"start:prod": "cross-env NODE_ENV=production node index.js",
|
||||
"lint": "eslint client server --ext .jsx --ext .js",
|
||||
"lint-fix": "eslint client server --ext .jsx --ext .js --fix",
|
||||
"build": "npm run build:client && npm run build:server",
|
||||
"build": "npm run build:client && npm run build:server && npm run build:examples",
|
||||
"build:client": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js --progress",
|
||||
"build:server": "cross-env NODE_ENV=production webpack --config webpack.config.server.js --progress",
|
||||
"build:examples": "cross-env NODE_ENV=production webpack --config webpack.config.examples.js --progress",
|
||||
"test": "npm run lint",
|
||||
"fetch-examples": "node ./server/scripts/fetch-examples.js",
|
||||
"fetch-examples-gg": "node ./server/scripts/fetch-examples-gg.js"
|
||||
"fetch-examples-gg": "node ./server/scripts/fetch-examples-gg.js",
|
||||
"fetch-examples:prod": "node ./dist/fetch-examples.bundle.js",
|
||||
"fetch-examples-gg:prod": "node ./dist/fetch-examples.bundle.js",
|
||||
"ssl-proxy": "local-ssl-proxy --source 443 --target 80 &"
|
||||
},
|
||||
"main": "index.js",
|
||||
"author": "Cassie Tarakajian",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require('babel-register');
|
||||
require('babel-polyfill');
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
require('dotenv').config();
|
||||
}
|
||||
require('./examples-gg-latest.js');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require('babel-register');
|
||||
require('babel-polyfill');
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
require('dotenv').config();
|
||||
}
|
||||
require('./examples.js');
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
const webpack = require('webpack');
|
||||
require('dotenv').config();
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
require('dotenv').config();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
devtool: 'cheap-module-eval-source-map',
|
||||
|
|
|
@ -6,7 +6,7 @@ const cssnext = require('postcss-cssnext');
|
|||
const postcssFocus = require('postcss-focus');
|
||||
const postcssReporter = require('postcss-reporter');
|
||||
const cssnano = require('cssnano');
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
require('dotenv').config();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue