Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# .env file
.env

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
.env.example

# vercel
.vercel
61 changes: 61 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build Master

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DD--HH

- name: Checkout code
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64,linux/arm
push: true
tags: |
calendso/calendso
calendso/calendso:latest-${{ steps.current-time.outputs.formattedTime }}
ghcr.io/calendso/calendso
ghcr.io/calendso/calendso:latest-${{ steps.current-time.outputs.formattedTime }}
ghcr.io/calendso/calendso
ghcr.io/calendso/calendso:latest-${{ steps.current-time.outputs.formattedTime }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: manual-dispatch

on:
workflow_dispatch:
inputs:
release:
description: 'Tag/Release to deploy'
required: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DD--HH

- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.release }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64,linux/arm
push: true
build-args: |
VUE_APP_VERSION=${{ github.event.inputs.release }}
tags: |
calendso/calendso:${{ github.event.inputs.release }}
ghcr.io/calendso/calendso:${{ github.event.inputs.release }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:14.16.1-alpine3.13 as build-stage
WORKDIR /app
COPY ./ .
RUN yarn install
RUN npm run build

FROM lsiobase/alpine:3.13 as deploy-stage
WORKDIR /app
RUN \
echo "**** install build packages ****" && \
apk add --no-cache \
nginx \
npm &&\
echo "**** Installing NPX ****" &&\
npm install &&\
echo "**** Cleaning Up ****" &&\
rm -rf \
/root/.cache \
/tmp/*
COPY root /
COPY --from=build-stage /app/.next/ /app
COPY nginx.conf /etc/nginx/
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "3.1"

services:
db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: ${DB_PASS:-changeme}

calendoso:
build: .
restart: always
ports:
- 3000:3000/tcp
environment:
- DATABASE_URL='postgresql://root:${DB_PASS:-changeme}@db:5432'
- GOOGLE_API_CREDENTIALS='secret'
34 changes: 34 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
user abc abc;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

http {
include /etc/nginx/mime.types;
### Set http options
# fallback in case we can't determine a type
default_type application/octet-stream;
access_log /var/log/nginx/access.log combined;
sendfile on;
keepalive_timeout 5;

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

server {
listen *:3000;

# Next
location / {
root /app;
index index.html;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}
}
}
5 changes: 5 additions & 0 deletions root/etc/cont-init.d/30-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bash

# permissions
chown -R abc:abc \
/app
4 changes: 4 additions & 0 deletions root/etc/cont-init.d/31-migrate
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/with-contenv bash

cd /app
npx prisma db push --preview-feature
9 changes: 9 additions & 0 deletions root/etc/services.d/nginx/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/with-contenv bash

#killall nginx

if pgrep -f "[n]ginx:" > /dev/null; then
pkill -ef [n]ginx:
fi

exec nginx -c /etc/nginx/nginx.conf -g "daemon off;"