Josh
12/22/2022, 2:30 AMDOCKER_BUILDKIT=0 docker compose build calcom
(all on my dev machine)… one question i have is… does docker
somehow need a connection to the database while building the image? /cc @Colin - KrumwareColin - Krumware
12/22/2022, 2:33 AMColin - Krumware
12/22/2022, 2:33 AMJosh
12/22/2022, 4:08 AMdocker compose up -d database
then, with my .env
configured to:
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=calendso
DATABASE_HOST=database:5432
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB}
i do:
DOCKER_BUILDKIT=0 docker compose build calcom
and end up with the error:
@calcom/prisma:build: Error: P1001: Can't reach database server at `database`:`5432`
@calcom/prisma:build:
@calcom/prisma:build: Please make sure your database server is running at `database`:`5432`.
@calcom/prisma:build: error Command failed with exit code 1.
@calcom/prisma:build: info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
@calcom/prisma:build: error Command failed with exit code 1.
@calcom/prisma:build: info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
everything else about the project is stock.
any thoughts here?Josh
12/22/2022, 5:49 AMDATABASE_URL
value from the env for the prisma build step seems to be broken. Notice above, where the error message says ‘Error: P1001: Can’t reach database server at `database`:`5432`’. (The additional backtick marks seems suspicious.) What DOES work is passing in this value via the command line, like: DOCKER_BUILDKIT=0 docker compose build --build-arg DATABASE_URL=<postgresql://postgres:postgres@host:5432/database> calcom
. (I tested setting the URL component values in the env to the same values as passed in via the command line like above: The env method failed and the command line method worked.)
2. The LAN IP address of the database
container needs to be used at the command line, not the generic database:5432
addressing. That is, before calling the above command, the user needs to docker-compose up database --detach
, docker exec -it database bash
, inside the database
container get the LAN IP address via hostname -I
, and then use that value as the appropriate URL host address within the command above. Example: DOCKER_BUILDKIT=0 docker compose build --build-arg DATABASE_URL=<postgresql://postgres:postgres@172.24.0.2:5432/database> calcom
zomars
12/22/2022, 9:16 PMColin - Krumware
12/22/2022, 9:21 PMJosh
12/23/2022, 2:15 AMJosh
12/23/2022, 2:15 AMFernando Sánchez
12/23/2022, 11:01 AMzamas_next | + scripts/replace-placeholder.sh
zamas_next | Nothing to replace, the value is already set to .
zamas_next | + yarn build
zamas_next | yarn run v1.22.19
zamas_next | $ turbo run build --filter=@calcom/web...
zamas_next | WARNING cannot find a .git folder. Falling back to manual file hashing (which may be slower). If you are running this build in a pruned directory, you can ignore this message. Otherwise, please initialize a git repos
itory in the root of your monorepo
zamas_next | • Packages in scope:
zamas_next | • Running build in 0 packages
zamas_next |
zamas_next | Tasks: 0 successful, 0 total
zamas_next | Cached: 0 cached, 0 total
zamas_next | Time: 2.963s
zamas_next |
zamas_next | Done in 5.17s.
zamas_next | yarn run v1.22.19
zamas_next | $ turbo run start --scope="@calcom/web"
zamas_next | • Packages in scope:
zamas_next |
zamas_next | Tasks: 0 successful, 0 total
zamas_next | Cached: 0 cached, 0 total
zamas_next | Time: 107ms
Has anyone experienced this issue?
This is my dockerfile
FROM node:16 as builder
RUN mkdir -p /app
WORKDIR /app
ARG NEXTAUTH_SECRET=secret
ARG CALENDSO_ENCRYPTION_KEY=secret
ARG NEXTAUTH_URL='<https://scheduling.hrbotfactory.com>'
ARG MAX_OLD_SPACE_SIZE=4096
ENV NEXTAUTH_SECRET=${NEXTAUTH_SECRET} \
CALENDSO_ENCRYPTION_KEY=${CALENDSO_ENCRYPTION_KEY}
COPY package.json yarn.lock turbo.json ./
COPY packages ./packages
COPY apps/web ./apps/web
RUN yarn global add turbo && \
yarn config set network-timeout 1000000000 -g && \
turbo prune --scope=@calcom/web --docker && \
yarn --global-folder /tmp/yarn/ install
#RUN yarn turbo run build --filter=@calcom/web
FROM node:16 as runner
WORKDIR /app
ARG NEXT_PUBLIC_WEBAPP_URL=<http://localhost:3000>
#ENV NODE_ENV production
RUN apt-get update && \
apt-get -y install netcat && \
rm -rf /var/lib/apt/lists/* && \
npm install --global prisma
COPY package.json yarn.lock turbo.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/packages ./packages
COPY --from=builder /app/apps/web ./apps/web
COPY --from=builder /app/packages/prisma/schema.prisma ./prisma/schema.prisma
COPY scripts scripts
RUN scripts/replace-placeholder.sh <http://NEXT_PUBLIC_WEBAPP_URL_PLACEHOLDER> ${NEXT_PUBLIC_WEBAPP_URL}
#ENV NODE_ENV development
RUN chmod 777 -R /app/node_modules/.cache/*
RUN chmod 777 -R /app/node_modules/.cache/turbo
COPY .env ./
COPY .env.example ./
COPY .env.appStore.example ./
COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next ./apps/web
EXPOSE 3000
CMD ["/app/scripts/start.sh"]
start.sh file:
#!/bin/sh
set -x
# Replace the statically built BUILT_NEXT_PUBLIC_WEBAPP_URL with run-time NEXT_PUBLIC_WEBAPP_URL
# NOTE: if these values are the same, this will be skipped.
scripts/replace-placeholder.sh "$BUILT_NEXT_PUBLIC_WEBAPP_URL" "$NEXT_PUBLIC_WEBAPP_URL"
yarn build
yarn start
Josh
12/23/2022, 4:17 PMColin - Krumware
12/23/2022, 7:15 PMFernando Sánchez
12/26/2022, 5:02 PMNhan Nguyen
12/30/2022, 4:43 AMColin - Krumware
12/30/2022, 3:09 PMJosh
12/30/2022, 6:44 PMJosh
12/30/2022, 6:45 PMDavid Billsbrough
01/03/2023, 9:08 PMJeff Loiselle
01/03/2023, 9:24 PMJeff Loiselle
01/03/2023, 9:24 PMColin - Krumware
01/04/2023, 2:40 PMColin - Krumware
01/04/2023, 2:41 PMJeff Loiselle
01/04/2023, 2:42 PMJeff Loiselle
01/04/2023, 2:43 PMColin - Krumware
01/04/2023, 2:44 PMJeff Loiselle
01/04/2023, 2:44 PMColin - Krumware
01/04/2023, 2:45 PMJeff Loiselle
01/04/2023, 2:46 PMJeff Loiselle
01/04/2023, 2:47 PMJeff Loiselle
01/04/2023, 2:47 PM