diff --git a/.env.example b/.env.example index 12f5fbcf4..51620ddef 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,5 @@ # environement details +#backend ENV=dev DISTRIBUTION=selfhosted @@ -6,9 +7,11 @@ POSTGRES_USER=my_user POSTGRES_PASSWORD=my_password POSTGRES_DB=panora_db POSTGRES_HOST=postgres - JWT_SECRET=secret_jwt - - OAUTH_REDIRECT_BASE=https://api-staging.panora.dev -ENCRYPT_CRYPTO_SECRET_KEY=selfhosted123 \ No newline at end of file +ENCRYPT_CRYPTO_SECRET_KEY=selfhosted123 + +# Webapp settings +# Must be set in the perspective of the end user browser +VITE_BACKEND_DOMAIN=http://localhost:3000 +VITE_FRONTEND_DOMAIN=http://localhost \ No newline at end of file diff --git a/apps/webapp/Dockerfile b/apps/webapp/Dockerfile index 30d972a3f..4a0d3c9a8 100644 --- a/apps/webapp/Dockerfile +++ b/apps/webapp/Dockerfile @@ -25,10 +25,15 @@ RUN apk update # Set pnpm ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" + +ARG VITE_BACKEND_DOMAIN +ARG VITE_FRONTEND_DOMAIN +ENV VITE_BACKEND_DOMAIN="$VITE_BACKEND_DOMAIN" +ENV VITE_FRONTEND_DOMAIN="$VITE_FRONTEND_DOMAIN" RUN corepack enable WORKDIR /app - + # First install the dependencies (as they change less often) COPY .gitignore .gitignore COPY --from=builder /app/out/json/ . @@ -42,6 +47,10 @@ RUN pnpm turbo run build --filter=webapp... # ======================================================================== FROM nginx:stable-alpine as runner +#ARG VITE_BACKEND_DOMAIN +#ARG VITE_FRONTEND_DOMAIN +#ENV VITE_BACKEND_DOMAIN="$VITE_BACKEND_DOMAIN" +#ENV VITE_FRONTEND_DOMAIN="$VITE_FRONTEND_DOMAIN" COPY --from=installer ./app/apps/webapp/dist/ /usr/share/nginx/html EXPOSE 80 diff --git a/docker-compose.yml b/docker-compose.yml index 7cc2faff3..a736797fb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,11 @@ name: panora version: '3.8' -services: +networks: + frontend: + backend: +services: postgres: image: postgres:16.1 environment: @@ -14,6 +17,8 @@ services: volumes: - ./pg_data:/var/lib/postgresql/data - ./packages/api/scripts/init.sql:/docker-entrypoint-initdb.d/init.sql + networks: + - backend api: build: @@ -29,14 +34,22 @@ services: - 3000:3000 depends_on: - postgres + networks: + - backend webapp: build: dockerfile: ./apps/webapp/Dockerfile context: ./ + args: + VITE_BACKEND_DOMAIN: ${VITE_BACKEND_DOMAIN} + VITE_FRONTEND_DOMAIN: ${VITE_FRONTEND_DOMAIN} restart: unless-stopped ports: - 80:80 depends_on: - - postgres + - api + networks: + - backend + - frontend