Skip to content

Commit

Permalink
feat!: start move to total nextjs frontend/backend
Browse files Browse the repository at this point in the history
  • Loading branch information
dinkelspiel committed Apr 25, 2024
1 parent f30eca1 commit decdc35
Show file tree
Hide file tree
Showing 363 changed files with 4,494 additions and 25,945 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
.git
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL="mysql://root:prisma@mysql:3306/database"
42 changes: 42 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const { resolve } = require('node:path');

const project = resolve(process.cwd(), 'tsconfig.json');

/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
rules: {
'turbo/no-undeclared-env-vars': 'off',
},
parserOptions: {
project: true,
},
extends: [
'eslint:recommended',
'prettier',
require.resolve('@vercel/style-guide/eslint/next'),
],
globals: {
React: true,
JSX: true,
},
env: {
node: true,
browser: true,
},
plugins: ['only-warn'],
settings: {
'import/resolver': {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
'.*.js',
'node_modules/',
],
overrides: [{ files: ['*.js?(x)', '*.ts?(x)'] }],
};
38 changes: 38 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Push
on:
- push

jobs:
build-and-push-container-image:
runs-on: ubuntu-20.04
env:
REGISTRY: ghcr.io
steps:
- uses: actions/checkout@v2

- name: Set environment variables
run: |
echo "IMAGE_NAME=$(echo "$REGISTRY/$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "GIT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
if [[ "${{ github.ref }}" == "refs/heads/"* ]]; then
GIT_REF=$(echo "${{ github.ref }}" | cut -d/ -f3)
else
GIT_REF=$(echo "${{ github.ref }}" | cut -d/ -f3)
fi
echo "GIT_REF=${GIT_REF}" >> $GITHUB_ENV
echo "IMAGE_TAG=${GIT_REF}-${GIT_SHA}" >> $GITHUB_ENV
- name: Docker Build
run: docker build --tag ${IMAGE_NAME}:${IMAGE_TAG} .

- name: Docker Login
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login $REGISTRY -u "${{ github.actor }}" --password-stdin

- name: Docker Push (Tagged)
run: docker push ${IMAGE_NAME}:${IMAGE_TAG}

- name: Tag image as latest
run: docker tag ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_NAME}:latest

- name: Docker Push (Latest)
run: docker push ${IMAGE_NAME}:latest
16 changes: 8 additions & 8 deletions frontend/.gitignore → .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@
# dependencies
/node_modules
/.pnp
/.pnpm-store
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# database
/prisma/db.sqlite
/prisma/db.sqlite-journal

# next.js
/.next/
/out/
next-env.d.ts

# production
/build
Expand All @@ -28,15 +25,18 @@ next-env.d.ts
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
# do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables
.env
.env*.local
.env

# vercel
.vercel

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

# cache
.prettiercache
.eslintjscache
50 changes: 50 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
stages:
- build
- push

image: docker:dind

before_script:
- echo $CI_JOB_TOKEN | docker login -u gitlab-ci-token --password-stdin $CI_REGISTRY

services:
- name: docker:dind
alias: docker
command: ['--tls=false']

variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375/
DOCKER_TLS_CERTDIR: ''

Build:
stage: build
except:
variables:
- $DOCKER_NO_CACHE
script:
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA

Push latest:
variables:
GIT_STRATEGY: none
stage: push
only:
- master
script:
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest

Push tag:
variables:
GIT_STRATEGY: none
stage: push
only:
- tags
script:
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
42 changes: 42 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Commonly ignored Node.js files
node_modules
npm-debug.log
.npm

# Next.js Build Output
.next
build

# Next.js Generated Files
public/static/documents

# Jest
coverage
.swc
junit.xml

# Storybook
storybook-static
build-storybook.log
.nyc_output

# Vercel Files
.vercel
.turbo
cache

# Cache Files
.eslintjscache
.eslintmdcache
.stylelintcache
.prettiercache

# TypeScript
tsconfig.tsbuildinfo

# Metadata Files
CODEOWNERS

# Prettier's Handlebar parser is limited and chokes on some syntax features
# https://github.com/prettier/prettier/issues/11834
scripts/release-post/template.hbs
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"jsxSingleQuote": false,
"trailingComma": "es5",
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "avoid"
}
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:iron
RUN npm install -g pnpm
WORKDIR /usr/src/app
RUN ls
SHELL ["/bin/bash", "--login", "-c"]
ENV SHELL bash
COPY . .
RUN mkdir -p /.cache/pnpm/dlx
RUN chmod 777 /.cache/pnpm/dlx/ -R
RUN mkdir -p /usr/src/app/.next/cache/fetch-cache
RUN chmod 777 /usr/src/app/.next/cache -R
RUN chmod 777 /usr/src/app -R
RUN chmod 744 ./prisma/schema.prisma
RUN pnpm install
RUN pnpm dlx prisma generate
RUN pnpm build
CMD ["pnpm", "start"]
11 changes: 11 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:iron
RUN npm install -g pnpm
COPY . /usr/src/app
WORKDIR /usr/src/app
SHELL ["/bin/bash", "--login", "-c"]
ENV SHELL bash
# RUN chmod 777 /usr/src/app -R
RUN chmod 744 ./prisma/schema.prisma
RUN pnpm install
RUN pnpm dlx prisma generate
CMD ["pnpm", "dev"]
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Medialog
# Medialog Frontend

A self hosted solution for privately rating and reviewing different sorts of media
## Run

## Frontend and Backend instructions exist in their respective directories
`pnpm install`
`pnpm dev`
7 changes: 7 additions & 0 deletions app/(app)/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';

const Page = () => {
return <div>Page</div>;
};

export default Page;
17 changes: 17 additions & 0 deletions app/(app)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Sidebar from '@/components/sidebar';
import React, { ReactNode } from 'react';

const Layout = ({ children }: { children: ReactNode }) => {
return (
<html lang="en">
<body
className={`grid grid-cols-1 grid-rows-[70px,1fr] lg:grid-rows-1 lg:grid-cols-[256px,1fr] min-h-[100dvh]`}
>
<Sidebar />
{children}
</body>
</html>
);
};

export default Layout;
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';

const Page = () => {
return <div className="font-bold text-xl">Test</div>;
};

export default Page;
18 changes: 0 additions & 18 deletions backend/.editorconfig

This file was deleted.

59 changes: 0 additions & 59 deletions backend/.env.example

This file was deleted.

Loading

0 comments on commit decdc35

Please sign in to comment.