Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first try #5

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
7 changes: 7 additions & 0 deletions .docker/scripts/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

echo "Applying Database Migrations"
/app/node_modules/.bin/prisma migrate deploy

echo "Starting Application"
node /app/lib/servers/graphql-main.js
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# If ran on docker linux
DATABASE_URL="postgresql://username:password@<local_public_ip>:5432/autifynetwork"
DATABASE_URL="postgresql://username:password@<local_public_ip>:5432/ranter"

# If ran on docker mac
DATABASE_URL="postgresql://username:password@host.docker.internal:5432/autifynetwork"
DATABASE_URL="postgresql://username:password@host.docker.internal:5432/ranter"

# If ran locally
DATABASE_URL="postgresql://username:password@localhsot:5432/autifynetwork"
DATABASE_URL="postgresql://username:password@localhsot:5432/ranter"
33 changes: 33 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and Push Docker image

on:
push:
branches:
- 'deployment-ci'

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- 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: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/my-app:latest
33 changes: 33 additions & 0 deletions .github/workflows/spinup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Spinup Server

on:
push:
branches: ['deployment-ci']

jobs:
spinup-server:
runs-on: ubuntu-latest

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

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'

- name: Install direnv
run: sudo apt-get install direnv -y

- name: Install dependencies
run: yarn install

- name: Build the app
run: yarn build

- name: Run Server & Get Healthz
run: |
. ./.envrc && yarn start &
sleep 5
curl --fail http://localhost:4000/healthz
21 changes: 17 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
FROM node:18
FROM node:18 AS BUILD_IMAGE

WORKDIR /app

# Install dependencies
COPY *.json ./yarn.lock ./
COPY . .
RUN yarn install --frozen-lockfile

# Run Source Code
COPY . .
# Build Source Code
COPY ./src ./src
RUN yarn build
RUN yarn install --frozen-lockfile --production

FROM node:18
COPY --from=BUILD_IMAGE /app/lib /app/lib
COPY --from=BUILD_IMAGE /app/node_modules /app/node_modules
COPY --from=BUILD_IMAGE /app/prisma /app/prisma
COPY --from=BUILD_IMAGE /app/.docker/scripts /app/.docker/scripts

WORKDIR /app
COPY ./*.js ./package.json ./tsconfig.json ./yarn.lock ./default.yaml ./

CMD [".docker/scripts/start.sh"]
19 changes: 19 additions & 0 deletions ci/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ranter-deploy-dev
spec:
replicas: 3
selector:
matchLabels:
app: ranter
template:
metadata:
labels:
app: ranter
spec:
containers:
- name: ranter
image: spantheslayer/ranter-dev-image:latest
ports:
- containerPort: 8080
69 changes: 0 additions & 69 deletions eslintonld.json

This file was deleted.

Loading