diff --git a/.env.template b/.env.template index 0acde41c9..4d1d47cfe 100644 --- a/.env.template +++ b/.env.template @@ -81,7 +81,7 @@ VITE_DEV_USERNAME=admin # The password to use if VITE_DEV_BYPASS_AUTH is set to true VITE_DEV_PASSWORD=Password12345678 # The base url for requests, which is overridden by reverse proxy in compose stack -VITE_API_BASE_URL=http://localhost:5500 +API_BASE_URL=http://localhost:5500 # The number of miliseconds to delay the result of HTTP requests in development VITE_DEV_NETWORK_LATENCY=0 # Plausable analytics config (optional, see vite.config.js for implementation) diff --git a/apps/gateway/Dockerfile b/apps/gateway/Dockerfile index 6bd608f77..a38055dc9 100644 --- a/apps/gateway/Dockerfile +++ b/apps/gateway/Dockerfile @@ -1,7 +1,6 @@ FROM node:lts-alpine as base WORKDIR /app -ARG GATEWAY_DATABASE_FILEPATH -ENV GATEWAY_DATABASE_URL=file:${GATEWAY_DATABASE_FILEPATH} +ENV GATEWAY_DATABASE_URL=file:/app/gateway.db ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" ENV NODE_OPTIONS="--max-old-space-size=8192" @@ -30,7 +29,7 @@ RUN pnpm dlx turbo run db:push --filter=@open-data-capture/database # RUN SERVER FROM base AS runner -COPY --from=installer ${GATEWAY_DATABASE_FILEPATH} ${GATEWAY_DATABASE_FILEPATH} +COPY --from=installer /app/gateway.db /app/gateway.db COPY --from=installer /app/apps/gateway/dist/ /app/dist/ COPY --from=installer /app/apps/gateway/public/ /app/public/ RUN echo '{ "type": "module" }' > package.json diff --git a/apps/web/.env.public b/apps/web/.env.public index 8e3242f60..cb0f4a016 100644 --- a/apps/web/.env.public +++ b/apps/web/.env.public @@ -1,3 +1,4 @@ +API_BASE_URL= CONTACT_EMAIL= DOCS_URL= GITHUB_REPO_URL= diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index f163a1a0d..089b7c5d7 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -14,7 +14,6 @@ RUN pnpm dlx turbo prune @open-data-capture/web --docker # INSTALL DEPENDENCIES FROM base AS installer -ARG VITE_API_BASE_URL RUN apk add --no-cache libc6-compat RUN apk update COPY .gitignore jsconfig.json ./ diff --git a/apps/web/src/config.ts b/apps/web/src/config.ts index 52bb0dd10..843a4830c 100644 --- a/apps/web/src/config.ts +++ b/apps/web/src/config.ts @@ -36,7 +36,7 @@ export const config = await $Config licenseUrl: import.meta.env.LICENSE_URL }, setup: { - apiBaseUrl: import.meta.env.VITE_API_BASE_URL, + apiBaseUrl: import.meta.env.API_BASE_URL, isGatewayEnabled: import.meta.env.GATEWAY_ENABLED } }) diff --git a/apps/web/src/vite-env.d.ts b/apps/web/src/vite-env.d.ts index f23ae1fe6..2053d6066 100644 --- a/apps/web/src/vite-env.d.ts +++ b/apps/web/src/vite-env.d.ts @@ -18,7 +18,7 @@ interface ImportMetaEnv extends ImportMetaDevEnv { readonly GATEWAY_ENABLED?: string; readonly GITHUB_REPO_URL?: string; readonly LICENSE_URL?: string; - readonly VITE_API_BASE_URL?: string; + readonly API_BASE_URL?: string; readonly VITE_DEV_NETWORK_LATENCY?: string; } diff --git a/docker-compose.yaml b/docker-compose.yaml index fb15f1383..9d0c6247f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -43,8 +43,6 @@ services: gateway: image: ghcr.io/douglasneuroinformatics/open-data-capture-gateway:${RELEASE_CHANNEL} build: - args: - GATEWAY_DATABASE_FILEPATH: /app/gateway.db context: . dockerfile: ./apps/gateway/Dockerfile ports: @@ -66,11 +64,10 @@ services: web: image: ghcr.io/douglasneuroinformatics/open-data-capture-web:${RELEASE_CHANNEL} build: - args: - VITE_API_BASE_URL: /api context: . dockerfile: ./apps/web/Dockerfile environment: + - API_BASE_URL=/api - CONTACT_EMAIL - DOCS_URL - GITHUB_REPO_URL