Skip to content

Commit 301e4dc

Browse files
committed
fix: clean .env.template
1 parent 4446c59 commit 301e4dc

31 files changed

+265
-169
lines changed

.dockerignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
node_modules
2+
dist
3+
*.log
4+
*.md
5+
.git
6+
.gitignore
7+
Dockerfile
8+
.dockerignore
9+
.env
10+
.env.template
11+
test
12+
assets
13+
nest-cli.json
14+
tsconfig.json
15+
tsconfig.build.json
16+
eslint.config.mjs
17+
.prettierrc

.env.template

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
DATABASE_URL=
1+
# SUPABASE
2+
SUPABASE_URL=
3+
SUPABASE_ANON_KEY=
4+
SUPABASE_JWT_SECRET=
25

36
# TYPESENSE
47
TYPESENSE_HOST=
58
TYPESENSE_PORT=
69
TYPESENSE_PROTOCOL=
710
TYPESENSE_API_KEY=
811

9-
# SUPABASE
10-
SUPABASE_URL=
11-
SUPABASE_ANON_KEY=
12-
SUPABASE_SERVICE_KEY=
13-
SUPABASE_JWT_SECRET=
14-
1512
# LOG_LEVEL (optional, defaults to "info")
1613
# LOG_LEVEL=debug
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build & Deploy API
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
jobs:
8+
build-deploy:
9+
runs-on: ubuntu-latest
10+
11+
permissions:
12+
contents: write
13+
packages: write
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: docker/login-action@v3
19+
with:
20+
registry: ghcr.io
21+
username: ${{ github.actor }}
22+
password: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Build image
25+
run: |
26+
VERSION=$(date +%Y%m%d%H%M%S)
27+
echo "VERSION=$VERSION" >> $GITHUB_ENV
28+
docker build \
29+
-t ghcr.io/${{ github.repository_owner }}/api:$VERSION .
30+
docker tag ghcr.io/${{ github.repository_owner }}/api:$VERSION ghcr.io/${{ github.repository_owner }}/api:latest
31+
32+
- name: Push image
33+
run: |
34+
docker push ghcr.io/${{ github.repository_owner }}/api:$VERSION
35+
docker push ghcr.io/${{ github.repository_owner }}/api:latest
36+
37+
- name: Clone infra repo
38+
run: |
39+
git clone https://ci-bot:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository_owner }}/infra.git
40+
41+
- name: Update api deployment image tag
42+
run: |
43+
cd infra/apps/services/api
44+
sed -i "s|image: ghcr.io.*/api.*|image: ghcr.io/${{ github.repository_owner }}/api:$VERSION|" deployment.yaml
45+
46+
- name: Commit manifest change
47+
run: |
48+
cd infra
49+
git config user.name "ci-bot"
50+
git config user.email "ci-bot@github.com"
51+
52+
git remote set-url origin https://ci-bot:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository_owner }}/infra.git
53+
54+
git add .
55+
git commit -m "deploy: api $VERSION" || echo "No changes to commit"
56+
git push origin main
57+
env:
58+
GIT_AUTHOR_NAME: ci-bot
59+
GIT_AUTHOR_EMAIL: ci-bot@github.com
60+
GIT_COMMITTER_NAME: ci-bot
61+
GIT_COMMITTER_EMAIL: ci-bot@github.com

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# 1. Build Stage
2+
FROM node:22-slim AS builder
3+
ENV PNPM_HOME="/pnpm"
4+
ENV PATH="$PNPM_HOME:$PATH"
5+
RUN corepack enable
6+
WORKDIR /usr/src/app
7+
COPY package.json pnpm-lock.yaml ./
8+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
9+
COPY . .
10+
RUN pnpm run build
11+
12+
# 2. Production Stage
13+
FROM node:22-slim AS production
14+
ENV PNPM_HOME="/pnpm"
15+
ENV PATH="$PNPM_HOME:$PATH"
16+
RUN corepack enable
17+
WORKDIR /usr/src/app
18+
COPY package.json pnpm-lock.yaml ./
19+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
20+
COPY --from=builder /usr/src/app/dist ./dist
21+
USER node
22+
EXPOSE 3000
23+
CMD ["node", "dist/main.js"]

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import tseslint from 'typescript-eslint';
66

77
export default tseslint.config(
88
{
9-
ignores: ['eslint.config.mjs'],
9+
ignores: ['eslint.config.mjs', 'src/types/__generated__/**'],
1010
},
1111
eslint.configs.recommended,
1212
...tseslint.configs.recommendedTypeChecked,

src/common/dto/genre.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Exclude, Expose } from 'class-transformer';
33
import { IsInt, IsString } from 'class-validator';
44

55
@Exclude()
6-
export class GenreDto {
6+
export class Genre {
77
@ApiProperty({ description: "The genre's ID" })
88
@Expose()
99
@IsInt()

src/common/dto/movie.dto.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import {
99
IsArray,
1010
IsDateString,
1111
} from 'class-validator';
12-
import { GenreDto } from './genre.dto';
13-
import { PersonDto } from './person.dto';
12+
import { Genre } from './genre.dto';
13+
import { Person } from './person.dto';
1414

1515
@Exclude()
16-
export class MovieDto {
16+
export class Movie {
1717
@ApiProperty({
1818
description: "The movie's unique identifier",
1919
example: 157336,
@@ -70,26 +70,26 @@ export class MovieDto {
7070
backdrop_url?: string | null;
7171

7272
@ApiProperty({
73-
type: () => PersonDto,
73+
type: () => Person,
7474
isArray: true,
7575
description: 'Directors of the movie',
7676
})
7777
@Expose()
7878
@IsOptional()
7979
@IsArray()
80-
@Type(() => PersonDto)
81-
directors?: PersonDto[];
80+
@Type(() => Person)
81+
directors?: Person[];
8282

8383
@ApiProperty({
84-
type: () => GenreDto,
84+
type: () => Genre,
8585
isArray: true,
8686
description: 'Genres of the movie',
8787
})
8888
@Expose()
8989
@IsOptional()
9090
@IsArray()
91-
@Type(() => GenreDto)
92-
genres?: GenreDto[];
91+
@Type(() => Genre)
92+
genres?: Genre[];
9393

9494
@ApiProperty({
9595
description: 'Release date of the movie',

src/common/dto/pagination.dto.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class PaginationQueryDto {
3030
per_page?: number = 10;
3131
}
3232

33-
export class PaginationMetaDto {
33+
export class PaginationMeta {
3434
@ApiProperty()
3535
@Expose()
3636
total_results: number;
@@ -54,10 +54,10 @@ export class PaginatedResponseDto<T> {
5454
@Expose()
5555
data: T[];
5656

57-
@ApiProperty({ type: PaginationMetaDto })
57+
@ApiProperty({ type: PaginationMeta })
5858
@Expose()
59-
@Type(() => PaginationMetaDto)
60-
pagination: PaginationMetaDto;
59+
@Type(() => PaginationMeta)
60+
pagination: PaginationMeta;
6161

6262
constructor(partial: Partial<PaginatedResponseDto<T>>) {
6363
Object.assign(this, partial);

src/common/dto/person.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Exclude, Expose } from 'class-transformer';
33
import { IsInt, IsString, IsOptional, IsUrl, IsNumber } from 'class-validator';
44

55
@Exclude()
6-
export class PersonDto {
6+
export class Person {
77
@ApiProperty({ description: "The person's unique identifier", example: 525 })
88
@Expose()
99
@IsInt()

src/common/dto/playlist.dto.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import {
1212
IsUrl,
1313
} from 'class-validator';
1414
import { Exclude, Expose, Type } from 'class-transformer';
15-
import { ProfileDto } from './profile.dto';
15+
import { Profile } from './profile.dto';
1616

1717
export type PlaylistType = 'movie' | 'tv_series';
1818

1919
@Exclude()
20-
export class PlaylistDto {
20+
export class Playlist {
2121
@ApiProperty({
2222
description: 'The unique identifier of the playlist',
2323
example: 461,
@@ -131,9 +131,9 @@ export class PlaylistDto {
131131
@IsNotEmpty()
132132
type: PlaylistType;
133133

134-
@ApiProperty({ type: () => ProfileDto, description: 'The user object' })
134+
@ApiProperty({ type: () => Profile, description: 'The user object' })
135135
@Expose()
136136
@ValidateNested()
137-
@Type(() => ProfileDto)
138-
user: ProfileDto;
137+
@Type(() => Profile)
138+
user: Profile;
139139
}

0 commit comments

Comments
 (0)