Merge pull request #51 from krumIO/docker-build-fixes

Update dockerfile and env variables
This commit is contained in:
Colin Griffin 2021-11-24 12:01:48 -05:00 committed by GitHub
commit 67663d0c5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 17 deletions

View File

@ -1,11 +1,22 @@
# Set this value to 'agree' to accept our license:
# LICENSE: https://github.com/calendso/calendso/blob/main/LICENSE
#
# Summary of terms:
# - The codebase has to stay open source, whether it was modified or not
# - You can not repackage or sell the codebase
# - Acquire a commercial license to remove these terms by emailing: license@cal.com
NEXT_PUBLIC_LICENSE_CONSENT=
LICENSE=
BASE_URL=http://localhost:3000
NEXT_PUBLIC_APP_URL=http://localhost:3000
POSTGRES_USER=unicorn_user
POSTGRES_PASSWORD=magical_password
POSTGRES_DB=calendso
DATABASE_HOST=db:5432
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB}"
GOOGLE_API_CREDENTIALS='secret'
BASE_URL='http://localhost:3000'
NEXTAUTH_URL='http://localhost:3000'
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB}
GOOGLE_API_CREDENTIALS={}
# Remove this var if you don't want Calendso to collect anonymous usage
NEXT_PUBLIC_TELEMETRY_KEY=js.2pvs2bbpqq1zxna97wcml.oi2jzirnbj1ev4tc57c5r
@ -20,13 +31,18 @@ ZOOM_CLIENT_SECRET=
# E-mail settings
# Configures the global From: header whilst sending emails.
EMAIL_FROM='notifications@example.com'
EMAIL_FROM=notifications@example.com
# Configure SMTP settings (@see https://nodemailer.com/smtp/).
EMAIL_SERVER_HOST='smtp.example.com'
EMAIL_SERVER_HOST=smtp.example.com
EMAIL_SERVER_PORT=587
EMAIL_SERVER_USER='email_user'
EMAIL_SERVER_PASSWORD='email_password'
EMAIL_SERVER_USER=email_user
EMAIL_SERVER_PASSWORD=email_password
# Encryption key that will be used to encrypt CalDAV credentials, choose a random string, for example with `dd if=/dev/urandom bs=1K count=1 | md5sum`
CALENDSO_ENCRYPTION_KEY=''
CALENDSO_ENCRYPTION_KEY=
# It is highly recommended that the JWT secret must be overridden and very unique
JWT_SECRET=secret
NODE_ENV=production

View File

@ -1,28 +1,36 @@
FROM node:14-alpine as deps
FROM node:14 as deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY calendso/package.json calendso/yarn.lock ./
COPY calendso/prisma prisma
RUN yarn install --frozen-lockfile
FROM node:14-alpine as builder
FROM node:14 as builder
WORKDIR /app
ARG BASE_URL
ENV BASE_URL $BASE_URL
ARG NEXT_PUBLIC_APP_URL
ENV NEXT_PUBLIC_APP_URL $NEXT_PUBLIC_APP_URL
COPY calendso .
COPY --from=deps /app/node_modules ./node_modules
RUN yarn build && yarn install --production --ignore-scripts --prefer-offline
FROM node:14-alpine as runner
FROM node:14 as runner
WORKDIR /app
ENV NODE_ENV production
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/scripts ./scripts
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/next-i18next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/prisma ./prisma
COPY scripts scripts
EXPOSE 3000
CMD ["/app/scripts/start.sh"]

View File

@ -10,15 +10,36 @@ services:
ports:
- 5432:5432
calendso:
build: .
build:
context: .
dockerfile: Dockerfile
args:
- BASE_URL=${BASE_URL}
- NEXT_PUBLIC_APP_URL=${NEXT_PUBLIC_APP_URL}
image: calendso/docker
restart: always
ports:
- 3000:3000
env_file: .env
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB}
depends_on:
- db
# Optional use of Prisma Studio. In production, comment out or remove the section below to prevent unwanted access to your database.
studio:
image: calendso/docker
restart: always
ports:
- 5555:5555
env_file: .env
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB}
depends_on:
- db
command:
- npx
- prisma
- studio
# END SECTION: Optional use of Prisma Studio.
volumes:
database-data:
database-data: