From 11783069a8a82cf47c04318e95600d57e69d55a0 Mon Sep 17 00:00:00 2001 From: Ahmed Al-Taiar Date: Mon, 7 Oct 2024 20:58:52 -0400 Subject: [PATCH] Docker setup --- .env.defaults | 8 ++++---- .env.example | 4 ++-- Dockerfile | 18 +++++++++++++----- api/src/functions/auth.ts | 3 +-- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.env.defaults b/.env.defaults index 5f93c8a..9d952f5 100644 --- a/.env.defaults +++ b/.env.defaults @@ -15,8 +15,8 @@ PRISMA_HIDE_UPDATE_MESSAGE=true # Ordered by how verbose they are: trace | debug | info | warn | error | silent # LOG_LEVEL=debug -FIRST_NAME=Ahmed -LAST_NAME=Al-Taiar +FIRST_NAME=firstname +LAST_NAME=lastname GMAIL=example@gmail.com GMAIL_SMTP_PASSWORD=chan geme xyza bcde @@ -25,9 +25,9 @@ DOMAIN=example.com API_DOMAIN=api.example.com # Must not end with "/" -ADDRESS_PROD=https://example.com +ADDRESS_PROD=https://portfolio.example.com ADDRESS_DEV=http://localhost:8910 -API_ADDRESS_PROD=https://api.example.com +API_ADDRESS_PROD=https://api-portfolio.example.com API_ADDRESS_DEV=http://localhost:8911 MAX_HTTP_CONNECTIONS_PER_MINUTE=60 diff --git a/.env.example b/.env.example index 95b21a6..7417ef6 100644 --- a/.env.example +++ b/.env.example @@ -13,9 +13,9 @@ DOMAIN=example.com API_DOMAIN=api.example.com # Must not end with "/" -ADDRESS_PROD=https://example.com +ADDRESS_PROD=https://portfolio.example.com ADDRESS_DEV=http://localhost:8910 -API_ADDRESS_PROD=https://api.example.com +API_ADDRESS_PROD=https://api-portfolio.example.com API_ADDRESS_DEV=http://localhost:8911 MAX_HTTP_CONNECTIONS_PER_MINUTE=60 diff --git a/Dockerfile b/Dockerfile index a96efa4..9df35e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,8 +37,16 @@ FROM base as api_build # If your api side build relies on build-time environment variables, # specify them here as ARGs. (But don't put secrets in your Dockerfile!) -# -# ARG MY_BUILD_TIME_ENV_VAR + +ARG ADDRESS_PROD +ARG API_ADDRESS_PROD +ARG ADDRESS_DEV +ARG API_ADDRESS_DEV +ARG MAX_HTTP_CONNECTIONS_PER_MINUTE +ARG GMAIL +ARG GMAIL_SMTP_PASSWORD +ARG FIRST_NAME +ARG LAST_NAME COPY --chown=node:node api api RUN yarn rw build api @@ -107,9 +115,9 @@ ENV NODE_ENV=production # If you are using a custom server file, you must use the following # command to launch your server instead of the default api-server below. # This is important if you intend to configure GraphQL to use Realtime. -# -# CMD [ "./api/dist/server.js" ] -CMD [ "node_modules/.bin/rw-server", "api" ] + +CMD [ "./api/dist/server.js" ] +# CMD [ "node_modules/.bin/rw-server", "api" ] # web serve # --------- diff --git a/api/src/functions/auth.ts b/api/src/functions/auth.ts index 8e8a31b..f706ae9 100644 --- a/api/src/functions/auth.ts +++ b/api/src/functions/auth.ts @@ -218,8 +218,7 @@ ${domain}/reset-password?resetToken=${resetToken} Path: '/', SameSite: isProduction ? 'None' : 'Strict', Secure: isProduction, - Domain: isProduction ? 'localhost' : 'localhost', - // Domain: isProduction ? process.env.DOMAIN : 'localhost', + Domain: isProduction ? process.env.DOMAIN : 'localhost', }, name: cookieName, },