111 lines
3.7 KiB
YAML
111 lines
3.7 KiB
YAML
# This is a basic workflow to help you get started with Actions
|
|
|
|
name: Build and push image to DockerHub
|
|
|
|
# Controls when the workflow will run
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
# update on run of Update Calendso nightly submodule update
|
|
workflow_run:
|
|
workflows: ["Update Calendso"]
|
|
branches: [main]
|
|
types:
|
|
- completed
|
|
# Allow running workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
NODE_OPTIONS: '--max_old_space_size=4096'
|
|
|
|
# Leaving in example for releases. Initially we simply push to 'latest'
|
|
# on:
|
|
# release:
|
|
# types: [ created ]
|
|
|
|
# # Allows you to run this workflow manually from the Actions tab
|
|
# workflow_dispatch:
|
|
|
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
jobs:
|
|
# This workflow contains a single job called "build"
|
|
build:
|
|
# The type of runner that the job will run on
|
|
runs-on: ubuntu-latest
|
|
|
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
steps:
|
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Git submodule update
|
|
run: |
|
|
git submodule update --init
|
|
|
|
- name: Docker Login
|
|
# You may pin to the exact commit or the version.
|
|
# uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
|
uses: docker/login-action@v1.10.0
|
|
with:
|
|
# Username used to log against the Docker registry
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
# Password or personal access token used to log against the Docker registry
|
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
# Log out from the Docker registry at the end of a job
|
|
logout: true # optional, default is true
|
|
|
|
- name: Set up Docker builder
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v1.6.0
|
|
|
|
- name: Copy env
|
|
run: |
|
|
grep -o '^[^#]*' .env.example > .env
|
|
cat .env >> $GITHUB_ENV
|
|
|
|
# - name: Set up Docker Buildx
|
|
# uses: docker/setup-buildx-action@v2
|
|
# with:
|
|
# driver-opts: |
|
|
# network=stack
|
|
|
|
- name: Start database
|
|
run: |
|
|
docker compose up -d database
|
|
|
|
# - name: Build and push image
|
|
# id: docker_build
|
|
# uses: docker/build-push-action@v2
|
|
# with:
|
|
# context: ./
|
|
# file: ./Dockerfile
|
|
# push: false
|
|
# # platforms: linux/amd64,linux/arm64
|
|
# # The test image is /docker and is private. final image will be /calendso and public
|
|
# tags: docker.io/${{ secrets.DOCKER_HUB_USERNAME }}/calendso:canary
|
|
# # network: stack
|
|
# build-args: |
|
|
# NEXT_PUBLIC_WEBAPP_URL=${{ env.NEXT_PUBLIC_WEBAPP_URL }}
|
|
# NEXT_PUBLIC_LICENSE_CONSENT=${{ env.NEXT_PUBLIC_LICENSE_CONSENT }}
|
|
# NEXT_PUBLIC_TELEMETRY_KEY=${{ env.NEXT_PUBLIC_TELEMETRY_KEY }}
|
|
# DATABASE_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.DATABASE_HOST }}/${{ env.POSTGRES_DB }}
|
|
|
|
- name: Build with docker compose
|
|
env:
|
|
NODE_OPTIONS: --max_old_space_size=4096
|
|
run: |
|
|
DOCKER_BUILDKIT=0 docker compose build --build-arg DATABASE_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.DATABASE_HOST }}/${{ env.POSTGRES_DB }} calcom
|
|
|
|
- name: Push docker image
|
|
run: |
|
|
docker tag docker_calcom:latest calendso/calendso:latest
|
|
docker push calendso/calendso:latest
|
|
|
|
- name: Cleanup
|
|
run: |
|
|
docker compose down
|
|
|
|
- name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|