Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mguptahub committed Jun 26, 2024
1 parent 86d2bc3 commit 2efd24c
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 170 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build-aio-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,60 @@ jobs:
DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}

full_build_push:
runs-on: ubuntu-20.04
needs: [base_build_setup, full_base_build_push]
env:
AIO_BASE_TAG: ${{ needs.base_build_setup.outputs.image_tag }}
AIO_IMAGE_TAGS: makeplane/plane-aio-app-full:${{ needs.base_build_setup.outputs.gh_branch_name }}
TARGET_BRANCH: ${{ needs.base_build_setup.outputs.gh_branch_name }}
BUILDX_DRIVER: ${{ needs.base_build_setup.outputs.gh_buildx_driver }}
BUILDX_VERSION: ${{ needs.base_build_setup.outputs.gh_buildx_version }}
BUILDX_PLATFORMS: ${{ needs.base_build_setup.outputs.gh_buildx_platforms }}
BUILDX_ENDPOINT: ${{ needs.base_build_setup.outputs.gh_buildx_endpoint }}
steps:
- name: Set Docker Tag
run: |
if [ "${{ github.event_name }}" == "release" ]; then
TAG=makeplane/plane-aio-app-full:stable
elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then
TAG=makeplane/plane-aio-app-full:latest
else
TAG=${{ env.AIO_IMAGE_TAGS }}
fi
echo "AIO_IMAGE_TAGS=${TAG}" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: ${{ env.BUILDX_DRIVER }}
version: ${{ env.BUILDX_VERSION }}
endpoint: ${{ env.BUILDX_ENDPOINT }}

- name: Check out the repo
uses: actions/checkout@v4

- name: Build and Push Frontend to Docker Container Registry
uses: docker/[email protected]
with:
context: .
file: ./aio/Dockerfile-app
platforms: ${{ env.BUILDX_PLATFORMS }}
tags: ${{ env.AIO_IMAGE_TAGS }}
push: true
build-args:
BUILD_TAG=${{ env.AIO_BASE_TAG }}
BUILD_TYPE=full

env:
DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}

37 changes: 20 additions & 17 deletions aio/Dockerfile-full → aio/Dockerfile-app
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
ARG BASE_TAG=develop
ARG BUILD_TYPE=full
# *****************************************************************************
# STAGE 1: Build the project
# *****************************************************************************
FROM node:18-alpine AS builder
RUN apk add --no-cache libc6-compat
# Set working directory
WORKDIR /app
ENV NEXT_PUBLIC_API_BASE_URL=http://NEXT_PUBLIC_API_BASE_URL_PLACEHOLDER

RUN yarn global add turbo
COPY . .
Expand Down Expand Up @@ -46,26 +47,27 @@ ENV NEXT_PUBLIC_SPACE_BASE_URL=$NEXT_PUBLIC_SPACE_BASE_URL
ARG NEXT_PUBLIC_SPACE_BASE_PATH="/spaces"
ENV NEXT_PUBLIC_SPACE_BASE_PATH=$NEXT_PUBLIC_SPACE_BASE_PATH

ENV NEXT_TELEMETRY_DISABLED 1
ENV TURBO_TELEMETRY_DISABLED 1
ARG NEXT_PUBLIC_WEB_BASE_URL=""
ENV NEXT_PUBLIC_WEB_BASE_URL=$NEXT_PUBLIC_WEB_BASE_URL

ENV NEXT_TELEMETRY_DISABLED=1
ENV TURBO_TELEMETRY_DISABLED=1

RUN yarn turbo run build
RUN yarn turbo run build --filter=web --filter=space --filter=admin

# *****************************************************************************
# STAGE 3: Copy the project and start it
# *****************************************************************************
# FROM makeplane/plane-aio-base AS runner
ARG BASE_TAG=develop
FROM makeplane/plane-aio-base-full:$BASE_TAG AS runner
FROM makeplane/plane-aio-base-${BUILD_TYPE}:${BASE_TAG} AS runner

WORKDIR /app

SHELL [ "/bin/bash", "-c" ]

# PYTHON APPLICATION SETUP

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1

COPY apiserver/requirements.txt ./api/
Expand All @@ -85,7 +87,6 @@ RUN chmod +x ./api/bin/*
RUN chmod -R 777 ./api/

# NEXTJS BUILDS

COPY --from=installer /app/web/next.config.js ./web/
COPY --from=installer /app/web/package.json ./web/
COPY --from=installer /app/web/.next/standalone ./web
Expand Down Expand Up @@ -122,25 +123,27 @@ ENV NEXT_PUBLIC_SPACE_BASE_PATH=$NEXT_PUBLIC_SPACE_BASE_PATH
ARG NEXT_PUBLIC_WEB_BASE_URL=""
ENV NEXT_PUBLIC_WEB_BASE_URL=$NEXT_PUBLIC_WEB_BASE_URL

ENV NEXT_TELEMETRY_DISABLED 1
ENV TURBO_TELEMETRY_DISABLED 1
ENV NEXT_TELEMETRY_DISABLED=1
ENV TURBO_TELEMETRY_DISABLED=1

COPY ./aio/nginx.conf /etc/nginx/nginx.conf.template
ARG BUILD_TYPE=full
ENV BUILD_TYPE=$BUILD_TYPE

COPY aio/supervisord-${BUILD_TYPE}-base /app/supervisord.conf
COPY aio/supervisord-app /app/supervisord-app
RUN cat /app/supervisord-app >> /app/supervisord.conf && \
rm /app/supervisord-app

COPY aio/aio.sh /app/aio.sh
RUN chmod +x /app/aio.sh

COPY aio/pg-setup.sh /app/pg-setup.sh
RUN chmod +x /app/pg-setup.sh

COPY deploy/selfhost/variables.env /app/plane.env

# NGINX Conf Copy
COPY ./aio/nginx.conf /etc/nginx/nginx.conf.template

# if build type is full, run the below copy pg-setup.sh
COPY aio/pg-setup.sh /app/pg-setup.sh
RUN chmod +x /app/pg-setup.sh
RUN ./pg-setup.sh

VOLUME [ "/app/data/minio/uploads", "/var/lib/postgresql/data" ]
Expand Down
1 change: 1 addition & 0 deletions aio/Dockerfile-base-full
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ RUN chmod +x /app/nginx-start.sh
RUN sudo -u postgres /usr/lib/postgresql/$POSTGRES_VERSION/bin/initdb -D /var/lib/postgresql/data
COPY postgresql.conf /etc/postgresql/postgresql.conf

ENV BUILD_TYPE=full
# Expose ports for Redis, PostgreSQL, and MinIO
EXPOSE 6379 5432 9000 80 443

Expand Down
2 changes: 2 additions & 0 deletions aio/Dockerfile-base-slim
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ COPY nginx.conf /etc/nginx/nginx.conf.template
COPY env.sh /app/nginx-start.sh
RUN chmod +x /app/nginx-start.sh

ENV BUILD_TYPE=slim

# Expose ports for Redis, PostgreSQL, and MinIO
EXPOSE 80 443

Expand Down
144 changes: 0 additions & 144 deletions aio/Dockerfile-slim

This file was deleted.

21 changes: 12 additions & 9 deletions aio/pg-setup.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#!/bin/bash

if [ "$BUILD_TYPE" == "full" ]; then

# Variables
set -o allexport
source plane.env set
set +o allexport
# Variables
set -o allexport
source plane.env set
set +o allexport

export PGHOST=localhost
export PGHOST=localhost

sudo -u postgres "/usr/lib/postgresql/${POSTGRES_VERSION}/bin/pg_ctl" -D /var/lib/postgresql/data start
sudo -u postgres "/usr/lib/postgresql/${POSTGRES_VERSION}/bin/psql" --command "CREATE USER $POSTGRES_USER WITH SUPERUSER PASSWORD '$POSTGRES_PASSWORD';" && \
sudo -u postgres "/usr/lib/postgresql/${POSTGRES_VERSION}/bin/createdb" -O "$POSTGRES_USER" "$POSTGRES_DB" && \
sudo -u postgres "/usr/lib/postgresql/${POSTGRES_VERSION}/bin/pg_ctl" -D /var/lib/postgresql/data stop
sudo -u postgres "/usr/lib/postgresql/${POSTGRES_VERSION}/bin/pg_ctl" -D /var/lib/postgresql/data start
sudo -u postgres "/usr/lib/postgresql/${POSTGRES_VERSION}/bin/psql" --command "CREATE USER $POSTGRES_USER WITH SUPERUSER PASSWORD '$POSTGRES_PASSWORD';" && \
sudo -u postgres "/usr/lib/postgresql/${POSTGRES_VERSION}/bin/createdb" -O "$POSTGRES_USER" "$POSTGRES_DB" && \
sudo -u postgres "/usr/lib/postgresql/${POSTGRES_VERSION}/bin/pg_ctl" -D /var/lib/postgresql/data stop

fi

0 comments on commit 2efd24c

Please sign in to comment.