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

fix compose build arg issue #730

Merged
merged 2 commits into from
Feb 29, 2024
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
2 changes: 1 addition & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions apps/gateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions apps/web/.env.public
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
API_BASE_URL=
CONTACT_EMAIL=
DOCS_URL=
GITHUB_REPO_URL=
Expand Down
1 change: 0 additions & 1 deletion apps/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
5 changes: 1 addition & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
Loading