-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/fix: fix backend docker paths, migration db connection issue, ad…
…d frontend dockerfile * feat: docker compose support * Set base URL outside of generated client --------- Co-authored-by: Yukine <[email protected]>
- Loading branch information
1 parent
1bcd6fc
commit aad319f
Showing
10 changed files
with
116 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
version: '3.1' | ||
|
||
services: | ||
postgres: | ||
image: postgres:16 | ||
environment: | ||
POSTGRES_USER: mangamagnet | ||
POSTGRES_PASSWORD: password | ||
POSTGRES_DB: mangamagnet | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U mangamagnet -d mangamagnet"] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
volumes: | ||
- data:/var/lib/postgresql/data | ||
|
||
backend: | ||
image: mangamagnet-backend | ||
build: | ||
context: ./backend | ||
dockerfile: MangaMagnet.Api/Dockerfile | ||
ports: | ||
- 43524:8080 | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
environment: | ||
DOTNET_ConnectionStrings__PostgreSQLConnection: Host=postgres;Port=5432;Database=mangamagnet;Username=mangamagnet;Password=password | ||
DOTNET_ConnectionStrings__QuartzPostgresSQLConnection: Host=postgres;Port=5432;Database=mangamagnet;Username=mangamagnet;Password=password;Search Path=quartz | ||
|
||
frontend: | ||
image: mangamagnet-frontend | ||
build: | ||
context: ./frontend | ||
dockerfile: Dockerfile | ||
ports: | ||
- 43525:3000 | ||
depends_on: | ||
- backend | ||
environment: | ||
API_BASE: http://backend:8080 | ||
|
||
volumes: | ||
data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
.git | ||
.gitignore | ||
*.md | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM node:20-slim AS base | ||
WORKDIR /app | ||
|
||
FROM base AS base-pnpm | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
|
||
FROM base-pnpm AS prod-deps | ||
COPY package.json pnpm-lock.yaml ./ | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile | ||
|
||
FROM base-pnpm AS build | ||
COPY . /app | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
RUN pnpm run build | ||
|
||
FROM base | ||
COPY --from=build /app/public ./public | ||
COPY --from=build /app/.next/standalone ./ | ||
COPY --from=build /app/.next/static ./.next/static | ||
ENV PORT 3000 | ||
EXPOSE 3000 | ||
CMD ["node", "server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { NextRequest, NextResponse } from "next/server"; | ||
|
||
export const config = { | ||
matcher: ["/api/:path*"], | ||
}; | ||
|
||
export function middleware(request: NextRequest) { | ||
const API_BASE = process.env.API_BASE ?? 'http://localhost:5248' | ||
|
||
return NextResponse.rewrite( | ||
new URL( | ||
`${API_BASE}${request.nextUrl.pathname}${request.nextUrl.search}` | ||
), | ||
{ request } | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import { OpenAPI } from '@/services/openapi' | ||
import '@/styles/globals.css' | ||
import type { AppProps } from 'next/app' | ||
|
||
OpenAPI.BASE = ''; | ||
|
||
export default function App({ Component, pageProps }: AppProps) { | ||
return <Component {...pageProps} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
interface ImportMetaEnv { | ||
readonly API_BASE: string | ||
} | ||
|
||
interface ImportMeta { | ||
readonly env?: ImportMetaEnv | ||
} |