1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-10 19:34:34 +00:00

fix(docker): docker-compose for prod+development

This commit is contained in:
Saad Jutt
2021-11-15 00:52:29 +05:00
parent 5e7cecf3ea
commit 4a363c5b97
12 changed files with 93 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
MODE=[server]
CORS=[enable]
PORT_WEB=[port for sasjs web component(react)]
ACCESS_TOKEN_SECRET=<secret>
REFRESH_TOKEN_SECRET=<secret>
AUTH_CODE_SECRET=<secret>

View File

@@ -3,7 +3,6 @@ WORKDIR /usr/server/api
COPY ["package.json","package-lock.json", "./"]
RUN npm ci
COPY . .
EXPOSE 5000
# RUN chown -R node /usr/server/api
# USER node
CMD ["npm","start"]

View File

@@ -13,10 +13,12 @@ dotenv.config()
const app = express()
const { MODE, CORS } = process.env
const { MODE, CORS, PORT_WEB } = process.env
if (MODE?.trim() !== 'server' || CORS?.trim() === 'enable') {
console.log('All CORS Requests are enabled')
app.use(cors({ credentials: true, origin: 'http://localhost:3000' }))
app.use(
cors({ credentials: true, origin: `http://localhost:${PORT_WEB ?? 3000}` })
)
}
app.use(express.json({ limit: '50mb' }))