Skip to content

Commit

Permalink
Merge pull request #1940 from ever-co/develop
Browse files Browse the repository at this point in the history
chore: docker file build with correct env vars
  • Loading branch information
evereq authored Dec 2, 2023
2 parents aae9491 + 17a0b40 commit ec17f73
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 7 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/docker-build-publish-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ jobs:
cache-to: type=inline
build-args: |
NODE_ENV=development
NEXT_PUBLIC_GAUZY_API_SERVER_URL=${{ secrets.NEXT_PUBLIC_GAUZY_API_SERVER_URL }}
NEXT_PUBLIC_GA_MEASUREMENT_ID=${{ secrets.NEXT_PUBLIC_GA_MEASUREMENT_ID }}
NEXT_PUBLIC_CAPTCHA_SITE_KEY=${{ secrets.NEXT_PUBLIC_CAPTCHA_SITE_KEY }}
NEXT_PUBLIC_DISABLE_AUTO_REFRESH=false
NEXT_PUBLIC_COOKIE_DOMAINS=${{ secrets.NEXT_PUBLIC_COOKIE_DOMAINS }}
NEXT_PUBLIC_BOARD_APP_DOMAIN=${{ secrets.NEXT_PUBLIC_BOARD_APP_DOMAIN }}
NEXT_PUBLIC_BOARD_BACKEND_POST_URL=${{ secrets.NEXT_PUBLIC_BOARD_BACKEND_POST_URL }}
NEXT_PUBLIC_BOARD_FIREBASE_CONFIG=${{ secrets.NEXT_PUBLIC_BOARD_FIREBASE_CONFIG }}
NEXT_PUBLIC_MEET_DOMAIN=${{ secrets.NEXT_PUBLIC_MEET_DOMAIN }}
NEXT_PUBLIC_SENTRY_DSN=${{ secrets.NEXT_PUBLIC_SENTRY_DSN }}
NEXT_PUBLIC_SENTRY_DEBUG=${{ secrets.NEXT_PUBLIC_SENTRY_DEBUG }}
NEXT_PUBLIC_JITSU_BROWSER_URL=${{ secrets.NEXT_PUBLIC_JITSU_BROWSER_URL }}
NEXT_PUBLIC_JITSU_BROWSER_WRITE_KEY=${{ secrets.NEXT_PUBLIC_JITSU_BROWSER_WRITE_KEY }}
NEXT_PUBLIC_GITHUB_APP_NAME=ever-github
NEXT_PUBLIC_CHATWOOT_API_KEY=${{ secrets.NEXT_PUBLIC_CHATWOOT_API_KEY }}
- name: Login to DockerHub
uses: docker/login-action@v2
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/docker-build-publish-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ jobs:
cache-to: type=inline
build-args: |
NODE_ENV=production
NEXT_PUBLIC_GAUZY_API_SERVER_URL=${{ secrets.NEXT_PUBLIC_GAUZY_API_SERVER_URL }}
NEXT_PUBLIC_GA_MEASUREMENT_ID=${{ secrets.NEXT_PUBLIC_GA_MEASUREMENT_ID }}
NEXT_PUBLIC_CAPTCHA_SITE_KEY=${{ secrets.NEXT_PUBLIC_CAPTCHA_SITE_KEY }}
NEXT_PUBLIC_DISABLE_AUTO_REFRESH=false
NEXT_PUBLIC_COOKIE_DOMAINS=${{ secrets.NEXT_PUBLIC_COOKIE_DOMAINS }}
NEXT_PUBLIC_BOARD_APP_DOMAIN=${{ secrets.NEXT_PUBLIC_BOARD_APP_DOMAIN }}
NEXT_PUBLIC_BOARD_BACKEND_POST_URL=${{ secrets.NEXT_PUBLIC_BOARD_BACKEND_POST_URL }}
NEXT_PUBLIC_BOARD_FIREBASE_CONFIG=${{ secrets.NEXT_PUBLIC_BOARD_FIREBASE_CONFIG }}
NEXT_PUBLIC_MEET_DOMAIN=${{ secrets.NEXT_PUBLIC_MEET_DOMAIN }}
NEXT_PUBLIC_SENTRY_DSN=${{ secrets.NEXT_PUBLIC_SENTRY_DSN }}
NEXT_PUBLIC_SENTRY_DEBUG=${{ secrets.NEXT_PUBLIC_SENTRY_DEBUG }}
NEXT_PUBLIC_JITSU_BROWSER_URL=${{ secrets.NEXT_PUBLIC_JITSU_BROWSER_URL }}
NEXT_PUBLIC_JITSU_BROWSER_WRITE_KEY=${{ secrets.NEXT_PUBLIC_JITSU_BROWSER_WRITE_KEY }}
NEXT_PUBLIC_GITHUB_APP_NAME=ever-github
NEXT_PUBLIC_CHATWOOT_API_KEY=${{ secrets.NEXT_PUBLIC_CHATWOOT_API_KEY }}
- name: Login to DockerHub
uses: docker/login-action@v2
Expand Down
48 changes: 42 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired
# Ever Teams Platform

ARG NODE_VERSION=18.17.1
ARG NEXT_PUBLIC_GAUZY_API_SERVER_URL=https://api.gauzy.co
ARG NEXT_PUBLIC_GA_MEASUREMENT_ID
ARG NEXT_PUBLIC_CAPTCHA_SITE_KEY
ARG NEXT_PUBLIC_DISABLE_AUTO_REFRESH=false
ARG NEXT_PUBLIC_COOKIE_DOMAINS=ever.team
ARG NEXT_PUBLIC_BOARD_APP_DOMAIN=https://board.ever.team
ARG NEXT_PUBLIC_BOARD_BACKEND_POST_URL=https://jsonboard.ever.team/api/v2/post/
ARG NEXT_PUBLIC_BOARD_FIREBASE_CONFIG
ARG NEXT_PUBLIC_MEET_DOMAIN=https://meet.ever.team
ARG NEXT_PUBLIC_SENTRY_DSN
ARG NEXT_PUBLIC_SENTRY_DEBUG
ARG NEXT_PUBLIC_JITSU_BROWSER_URL
ARG NEXT_PUBLIC_JITSU_BROWSER_WRITE_KEY
ARG NEXT_PUBLIC_GITHUB_APP_NAME=ever-github
ARG NEXT_PUBLIC_CHATWOOT_API_KEY

FROM node:${NODE_VERSION}-slim as base

LABEL maintainer="[email protected]"
LABEL org.opencontainers.image.source https://github.com/ever-co/ever-teams

# Next.js app lives here
WORKDIR /app

Expand All @@ -14,17 +34,33 @@ ENV NEXT_SHARP_PATH=/temp/node_modules/sharp
RUN npm i -g npm@latest
# Install sharp, NextJS image optimization
RUN mkdir /temp && cd /temp && \
npm i sharp
npm i sharp

RUN npm cache clean --force


# Throw-away build stage to reduce size of final image
FROM base as build

# We make env vars passed as build argument to be available in this build stage because we prebuild the NextJs app
ARG NEXT_PUBLIC_GAUZY_API_SERVER_URL
ARG NEXT_PUBLIC_GA_MEASUREMENT_ID
ARG NEXT_PUBLIC_CAPTCHA_SITE_KEY
ARG NEXT_PUBLIC_DISABLE_AUTO_REFRESH
ARG NEXT_PUBLIC_COOKIE_DOMAINS
ARG NEXT_PUBLIC_BOARD_APP_DOMAIN
ARG NEXT_PUBLIC_BOARD_BACKEND_POST_URL
ARG NEXT_PUBLIC_BOARD_FIREBASE_CONFIG
ARG NEXT_PUBLIC_MEET_DOMAIN
ARG NEXT_PUBLIC_SENTRY_DSN
ARG NEXT_PUBLIC_SENTRY_DEBUG
ARG NEXT_PUBLIC_JITSU_BROWSER_URL
ARG NEXT_PUBLIC_JITSU_BROWSER_WRITE_KEY
ARG NEXT_PUBLIC_GITHUB_APP_NAME
ARG NEXT_PUBLIC_CHATWOOT_API_KEY

# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install -y build-essential pkg-config python-is-python3
apt-get install -y build-essential pkg-config python-is-python3

# Install Yarn
RUN npm install -g yarn --force
Expand All @@ -35,7 +71,7 @@ COPY yarn.lock ./
COPY apps/web/package.json ./apps/web/package.json

RUN cd apps/web && \
yarn install --ignore-scripts
yarn install --ignore-scripts

# Copy application code
COPY . .
Expand All @@ -47,7 +83,7 @@ RUN yarn run build:web

# Remove development dependencies
RUN cd apps/web && \
yarn install --prod --ignore-scripts
yarn install --prod --ignore-scripts

RUN yarn cache clean

Expand Down
2 changes: 1 addition & 1 deletion apps/web/.env
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ APP_LOGO_URL="https://app.ever.team/assets/ever-teams.png"
NEXT_PUBLIC_COOKIE_DOMAINS=ever.team

# Board
NEXT_PUBLIC_BOARD_APP_DOMAIN=https://board.ever.team
NEXT_PUBLIC_BOARD_APP_DOMAIN="https://board.ever.team"
NEXT_PUBLIC_BOARD_BACKEND_POST_URL="https://jsonboard.ever.team/api/v2/post/"
NEXT_PUBLIC_BOARD_FIREBASE_CONFIG=

Expand Down

0 comments on commit ec17f73

Please sign in to comment.