Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
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
Binary file modified .DS_Store
Binary file not shown.
25 changes: 23 additions & 2 deletions .github/workflows/blank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,36 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

# Runs a single command using the runners shell
# Runs a single command using the runner's shell
- name: Run a one-line script
run: echo Hello, world!

# Runs a set of commands using the runners shell
# Runs a set of commands using the runner's shell
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.

# Set up Node.js for the workflow
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

# Install dependencies using Yarn
- name: Install all packages
run: cd code && yarn install

# Lint the codebase to ensure code quality
- name: Run linting
run: cd code && yarn lint

# Run tests to verify functionality
- name: Run tests
run: cd code && yarn test

# Validate Prisma schema for consistency
- name: Validate Prisma schema
run: |
cd code
npx prisma validate
39 changes: 39 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CD

on:
push:
branches:
- "main"
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest

steps:
# Checkout repository
- uses: actions/checkout@v4

# Log in to DockerHub
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# Build and push Docker image
- name: Build and Push Docker Image
run: |
docker build -t your-dockerhub-username/resumeai:latest .
docker tag your-dockerhub-username/resumeai:latest your-dockerhub-username/resumeai:latest
docker push your-dockerhub-username/resumeai:latest

# Deploy application on server
- name: Deploy Application
run: |
ssh user@server-ip << 'EOF'
docker pull your-dockerhub-username/resumeai:latest
docker stop resumeai || true
docker rm resumeai || true
docker run -d --name resumeai -p 3000:3000 --env-file .env your-dockerhub-username/resumeai:latest
EOF
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
# Checkout repository
- uses: actions/checkout@v4

# Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

# Install dependencies
- name: Install dependencies with Yarn
run: |
cd code
yarn install

# Lint code
- name: Lint codebase
run: |
cd code
yarn lint

# Run tests
- name: Run tests
run: |
cd code
yarn test

# Validate Prisma schema
- name: Validate Prisma schema
run: |
cd code
npx prisma validate

# Build Docker image
- name: Build Docker image
run: |
docker build -t resumeai:latest .

# Run Docker Compose to test services
- name: Test services with Docker Compose
run: docker-compose up --build --abort-on-container-exit --exit-code-from resumeai
21 changes: 18 additions & 3 deletions code/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Use a minimal Node.js base image
FROM node:20.9-alpine

# Set working directory
WORKDIR /app
COPY . /app/
RUN yarn install
CMD [ "yarn start" ]

# Copy package.json and yarn.lock first for better caching
COPY package.json yarn.lock ./

# Install dependencies
RUN yarn install --production

# Copy the rest of the application code
COPY . .

# Expose the application port
EXPOSE 3000

# Command to start the application
CMD ["yarn", "start"]
28 changes: 28 additions & 0 deletions code/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,47 @@ services:
- .env
ports:
- 5432:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $POSTGRES_USER"]
interval: 10s
timeout: 5s
retries: 5

redis:
image: redis
ports:
- 6379:6379
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5

keycloak:
image: quay.io/keycloak/keycloak
ports:
- 8080:8080
env_file:
- .env
command: start-dev
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080"]
interval: 10s
timeout: 5s
retries: 5

resumeai:
build: .
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
keycloak:
condition: service_healthy
ports:
- 3000:3000
env_file:
- .env
command: yarn start

Loading