Skip to content

Commit

Permalink
Merge pull request #4 from davitJabushanuri/hotfix/1.9.1
Browse files Browse the repository at this point in the history
Hotfix/1.9.1
  • Loading branch information
davitJabushanuri committed Feb 27, 2024
2 parents ceaafdb + 42cf28c commit 238126e
Show file tree
Hide file tree
Showing 45 changed files with 1,439 additions and 4,271 deletions.
60 changes: 60 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
### STANDARD GIT IGNORE FILE ###

# DEPENDENCIES
node_modules/
/.pnp
.pnp.js
package-lock.json
yarn.lock

# TESTING
/coverage
*.lcov
.nyc_output

# BUILD
build/
public/build/
dist/
generated/

# ENV FILES
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

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

# MISC
.idea
.turbo/
.cache/
.next/
.nuxt/
tmp/
temp/
.eslintcache
.docusaurus

# MAC
._*
.DS_Store
Thumbs.db

.turbo
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

Dockerfile
.dockerignore
.git
62 changes: 37 additions & 25 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
# Database configuration
# Replace with your database URL. For example: postgres://user:password@localhost:5432/mydatabase
DATABASE_URL=""

# NextAuth configuration
# Replace with your NextAuth URL. This is the URL where your application is running. For example: http://localhost:3000
NEXTAUTH_URL=""

# Generate a secret for NextAuth with `openssl rand -hex 64` and replace here
NEXTAUTH_SECRET=""

# Google OAuth configuration
# Replace with your Google Client ID and Secret. These are obtained from the Google Developer Console.
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""

# Node environment
# Set to "development" for development mode or "production" for production mode
NODE_ENV="development"

# Vercel KV configuration
KV_URL=""
KV_REST_API_URL=""
KV_REST_API_TOKEN=""
KV_REST_API_READ_ONLY_TOKEN=""
# DATABASE CONFIGURATION
# The application uses a PostgreSQL database. You can obtain the database URL from your database provider.
DATABASE_URL=postgres://username:password@localhost:5432/your-database

# NEXTAUTH CONFIGURATION
# NextAuth is used for authentication in the application. You need to specify the URL where the Next.js application is running and a secret for session cookies.

NEXTAUTH_URL=http://localhost:3000

# You can generate a random secret using a tool like `uuidgen` or any other random string generator.
NEXTAUTH_SECRET=

# GOOGLE AUTHENTICATION CONFIGURATION
# The application supports authentication with Google. You need to create a project in the Google Developers Console, enable the Google Sign-In API, and create OAuth 2.0 credentials.
# More information: https://developers.google.com/identity/sign-in/web/sign-in
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

# SUPABASE CONFIGURATION
# The application uses Supabase for real-time updates. You need to create a project in Supabase and obtain the URL and the anonymous key.
# More information: https://supabase.io/docs/guides/with-nextjs

# Example: https://yourproject.supabase.co
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=

# WEBSOCKET CONFIGURATION
# The application uses a WebSocket server for real-time communication. Specify the URL of the WebSocket server.
# Example: http://localhost:8080
NEXT_PUBLIC_SOCKET_URL=

# UPSTASH CONFIGURATION
# The application uses Upstash for rate limiting.
# You need to create an account on Upstash and obtain the Redis REST URL and Token.
# More information: https://upstash.com
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=
9 changes: 0 additions & 9 deletions .env.local.example

This file was deleted.

2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = {
"plugin:jsx-a11y/recommended",
"plugin:testing-library/react",
"plugin:jest-dom/recommended",
"plugin:cypress/recommended",
"plugin:@tanstack/eslint-plugin-query/recommended",
"plugin:tailwindcss/recommended",
"prettier",
Expand All @@ -23,7 +22,6 @@ module.exports = {
"@typescript-eslint",
"testing-library",
"jest-dom",
"cypress",
"@tanstack/query",
"prettier",
],
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy
on:
push:
branches:
- main
- develop
pull_request: {}

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: 👀 Read app name
uses: SebRollen/[email protected]
id: app_name
with:
file: "fly.toml"
field: "app"

- name: Setup fly
uses: superfly/flyctl-actions/setup-flyctl@master

- name: Deploy Staging
if: ${{ github.ref == 'develop' }}
run: flyctl deploy --remote-only --build-arg NEXT_PUBLIC_SOCKET_URL=${{ secrets.NEXT_PUBLIC_SOCKET_URL }} --build-arg NEXT_PUBLIC_SUPABASE_URL=${{secrets.NEXT_PUBLIC_SUPABASE_URL}} --build-arg NEXT_PUBLIC_SUPABASE_ANON_KEY=${{secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY}} --app ${{ steps.app_name.outputs.value }}-staging
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

- name: Deploy Production
if: ${{ github.ref == 'refs/heads/main' }}
run: flyctl deploy --remote-only --build-arg NEXT_PUBLIC_SOCKET_URL=${{ secrets.NEXT_PUBLIC_SOCKET_URL }} --build-arg NEXT_PUBLIC_SUPABASE_URL=${{secrets.NEXT_PUBLIC_SUPABASE_URL}} --build-arg NEXT_PUBLIC_SUPABASE_ANON_KEY=${{secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY}}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
67 changes: 67 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
ARG NODE_VERSION=20.10.0
# base image
FROM node:${NODE_VERSION}-slim as base

# Set output property to standalone for minimal image size
ENV BUILD_STANDALONE="true"

# Disable telemetry
ENV NEXT_TELEMETRY_DISABLED="1"

# Set environment variables needed for the build process
ARG NEXT_PUBLIC_SUPABASE_URL
ENV NEXT_PUBLIC_SUPABASE_URL=${NEXT_PUBLIC_SUPABASE_URL}

ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=${NEXT_PUBLIC_SUPABASE_ANON_KEY}

ARG NEXT_PUBLIC_SOCKET_URL
ENV NEXT_PUBLIC_SOCKET_URL=${NEXT_PUBLIC_SOCKET_URL}

# Install openssl for Prisma
RUN apt-get update && apt-get install -y openssl

# Install pnpm
ARG PNPM_VERSION=8.15.1
RUN npm install -g pnpm@$PNPM_VERSION

# Install dependencies
FROM base as deps
WORKDIR /app

# Install node modules
COPY --link package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile

# Build the application
FROM base as build
WORKDIR /app

# Copy application code
COPY src/ src/
COPY public/ public/
COPY prisma/schema.prisma prisma/
COPY next.config.js postcss.config.js tailwind.config.js tsconfig.json reset.d.ts ./

COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/package.json ./package.json
COPY --from=deps /app/pnpm-lock.yaml ./pnpm-lock.yaml

# Generate Prisma Client
RUN npx prisma generate

# Build application
RUN pnpm build

# Production image
FROM base as prod
WORKDIR /app

ENV NODE_ENV="production"

COPY --from=build /app/public ./public
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static

EXPOSE 3000
CMD [ "node", "server.js" ]
16 changes: 0 additions & 16 deletions cypress.config.ts

This file was deleted.

Loading

0 comments on commit 238126e

Please sign in to comment.