-
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.
The nginx handles the routing to api and frontend, so that we can run both in development mode.
- Loading branch information
Showing
6 changed files
with
81 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
version="1.0.0", | ||
docs_url="/api/docs", | ||
redoc_url="/api/redoc", | ||
openapi_url="/api/openapi.json", | ||
) | ||
|
||
|
||
|
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 |
---|---|---|
@@ -1,15 +1,23 @@ | ||
FROM node:22-alpine3.20 | ||
|
||
FROM node:22-alpine3.20 AS base | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
|
||
RUN corepack enable | ||
|
||
WORKDIR /app/player | ||
|
||
WORKDIR /app | ||
COPY pnpm-lock.yaml package.json ./ | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
|
||
FROM base AS dev | ||
EXPOSE 3000 | ||
|
||
CMD [ "pnpm", "run", "dev", "--host", "0.0.0.0" ] | ||
|
||
|
||
FROM base AS builder | ||
RUN pnpm generate | ||
|
||
|
||
FROM nginx:1.27.1-alpine AS prod | ||
COPY ./docker/frontend.nginx.conf /etc/nginx/templates/default.conf.template | ||
COPY --from=builder /app/dist /usr/share/nginx/html | ||
ENV API_HOST=api | ||
EXPOSE 80 | ||
CMD ["nginx", "-g", "daemon off;"] |
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 |
---|---|---|
|
@@ -41,5 +41,6 @@ | |
"@vueuse/core": "^11.0.3", | ||
"leaflet": "^1.9.4", | ||
"lodash-es": "^4.17.21" | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1" | ||
} |
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,28 @@ | ||
upstream api { | ||
server ${API_HOST}:8000; | ||
} | ||
|
||
upstream frontend { | ||
server ${FRONTEND_HOST}:3000; | ||
} | ||
|
||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name localhost; | ||
charset utf-8; | ||
|
||
location ~* ^/(api)($|/) { | ||
proxy_pass http://api; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $http_host; | ||
proxy_redirect off; | ||
} | ||
|
||
location / { | ||
proxy_pass http://frontend; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $http_host; | ||
proxy_redirect off; | ||
} | ||
} |