Skip to content

Commit 2309065

Browse files
authored
Merge pull request #45 from NCTUCSUnion/dev
Dev
2 parents 17cdf96 + 9e2eff2 commit 2309065

7 files changed

Lines changed: 104 additions & 49 deletions

File tree

backend/Dockerfile.dev

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
2+
3+
WORKDIR /app
4+
5+
ENV UV_COMPILE_BYTECODE=1
6+
7+
ENV UV_LINK_MODE=copy
8+
9+
RUN --mount=type=cache,target=/root/.cache/uv \
10+
--mount=type=bind,source=uv.lock,target=uv.lock \
11+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
12+
uv sync --locked --no-install-project --no-dev
13+
14+
COPY . /app
15+
RUN --mount=type=cache,target=/root/.cache/uv \
16+
uv sync --locked --no-dev
17+
18+
ENV PATH="/app/.venv/bin:$PATH"
19+
20+
ENTRYPOINT []
21+
22+
# CMD ["fastapi", "dev", "--host", "0.0.0.0", "main.py", "--root-path", "/api"]
23+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--root-path", "/api", "--reload"]
24+

docker/docker-compose.dev.yml

Lines changed: 56 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
11
name: pastexam-dev
22

33
services:
4-
# frontend:
5-
# build: ../frontend
6-
# container_name: pastexam-dev-frontend
7-
# ports:
8-
# - "5173:80"
9-
# env_file:
10-
# - ../frontend/.env
11-
# networks:
12-
# - app_network
4+
frontend:
5+
build:
6+
context: ../frontend
7+
dockerfile: Dockerfile.dev
8+
container_name: pastexam-dev-frontend
9+
ports:
10+
# - "5173:80"
11+
- "24678:24678"
12+
env_file:
13+
- ../frontend/.env
14+
volumes:
15+
- /app/node_modules
16+
- ../frontend:/app
17+
networks:
18+
- app_network
1319

14-
# backend:
15-
# build: ../backend
16-
# container_name: pastexam-dev-backend
17-
# depends_on:
18-
# db:
19-
# condition: service_healthy
20-
# redis:
21-
# condition: service_started
22-
# minio:
23-
# condition: service_started
24-
# # ports:
25-
# # - "8000:8000"
26-
# env_file:
27-
# - ../backend/.env
28-
# networks:
29-
# - app_network
20+
backend:
21+
build:
22+
context: ../backend
23+
dockerfile: Dockerfile.dev
24+
container_name: pastexam-dev-backend
25+
depends_on:
26+
db:
27+
condition: service_healthy
28+
redis:
29+
condition: service_started
30+
minio:
31+
condition: service_started
32+
# ports:
33+
# - "8000:8000"
34+
volumes:
35+
- /app/.venv
36+
- ../backend:/app
37+
env_file:
38+
- ../backend/.env
39+
networks:
40+
- app_network
3041

3142
db:
3243
image: postgres:15.14-alpine3.22
@@ -35,8 +46,8 @@ services:
3546
POSTGRES_USER: ${POSTGRES_USER}
3647
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
3748
POSTGRES_DB: ${POSTGRES_DB}
38-
ports:
39-
- "${POSTGRES_PORT}:${POSTGRES_PORT}"
49+
# ports:
50+
# - "${POSTGRES_PORT}:${POSTGRES_PORT}"
4051
volumes:
4152
- pg_data:/var/lib/postgresql/data
4253
healthcheck:
@@ -51,9 +62,9 @@ services:
5162
image: quay.io/minio/minio:RELEASE.2025-05-24T17-08-30Z
5263
container_name: pastexam-dev-minio
5364
command: server /data --console-address ":9001"
54-
ports:
55-
- "9000:9000"
56-
- "9001:9001" # 9000 for S3 API, 9001 for MinIO Console
65+
# ports:
66+
# - "9000:9000"
67+
# - "9001:9001" # 9000 for S3 API, 9001 for MinIO Console
5768
environment:
5869
- MINIO_ROOT_USER=${MINIO_ROOT_USER}
5970
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}
@@ -70,28 +81,27 @@ services:
7081

7182
redis:
7283
image: redis:7.4.5-alpine3.21
73-
restart: always
7484
container_name: pastexam-dev-redis
75-
ports:
76-
- "6379:6379"
85+
# ports:
86+
# - "6379:6379"
7787
volumes:
7888
- redis_data:/data
7989
networks:
8090
- app_network
8191

82-
# nginx:
83-
# image: nginx:1.29.1-perl
84-
# container_name: pastexam-dev-nginx
85-
# ports:
86-
# - "8080:8080"
87-
# volumes:
88-
# - ../proxy/nginx.conf:/etc/nginx/nginx.conf:ro
89-
# depends_on:
90-
# - frontend
91-
# - backend
92-
# - minio
93-
# networks:
94-
# - app_network
92+
nginx:
93+
image: nginx:1.29.1-perl
94+
container_name: pastexam-dev-nginx
95+
ports:
96+
- "8080:8080"
97+
volumes:
98+
- ../proxy/nginx.conf:/etc/nginx/nginx.conf:ro
99+
depends_on:
100+
- frontend
101+
- backend
102+
- minio
103+
networks:
104+
- app_network
95105

96106
networks:
97107
app_network:

docker/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ services:
55
image: ghcr.io/nctucsunion/pastexam:frontend
66
container_name: pastexam-frontend
77
restart: always
8-
ports:
9-
- "5173:80"
8+
# ports:
9+
# - "5173:80"
1010
networks:
1111
- app_network
1212

frontend/Dockerfile.dev

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:18-alpine AS build
2+
WORKDIR /app
3+
4+
RUN corepack enable && corepack prepare pnpm@9.0.0 --activate
5+
6+
COPY package.json pnpm-lock.yaml ./
7+
8+
RUN pnpm install --frozen-lockfile
9+
10+
COPY . .
11+
12+
CMD ["pnpm", "run", "dev", "--host", "0.0.0.0", "--port", "80"]

frontend/src/components/NotificationModal.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
modal
66
:style="{ width: '480px', maxWidth: '90vw' }"
77
:draggable="false"
8-
:dismissableMask="true"
98
:showHeader="true"
109
header="系統公告"
1110
:blockScroll="true"

frontend/vite.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ import Sitemap from 'vite-plugin-sitemap'
99

1010
// https://vitejs.dev/config/
1111
export default defineConfig({
12+
server: {
13+
host: true,
14+
port: 80,
15+
strictPort: true,
16+
hmr: {
17+
port: 24678,
18+
clientPort: 24678,
19+
},
20+
},
1221
plugins: [
1322
vue(),
1423
vueDevTools({

proxy/nginx.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ http {
77
map $http_origin $cors_origin {
88
default "";
99
"http://localhost:5173" $http_origin;
10+
"http://localhost:8080" $http_origin;
1011
"https://pastexam.nctucsunion.me" $http_origin;
1112
}
1213

0 commit comments

Comments
 (0)