Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed broken frontend base URLs in docker-compose #128

Merged
merged 4 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# environement details
#backend
ENV=dev
DISTRIBUTION=selfhosted

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
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
11 changes: 10 additions & 1 deletion apps/webapp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/ .
Expand All @@ -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
Expand Down
17 changes: 15 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: panora
version: '3.8'

services:
networks:
frontend:
backend:

services:
postgres:
image: postgres:16.1
environment:
Expand All @@ -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:
Expand All @@ -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
Loading