Skip to content

Commit c6c2b22

Browse files
committed
update tasks w/ docker and etc.
1 parent 34c215b commit c6c2b22

15 files changed

+354
-62
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# advena
22

33
<p align="center">
4-
コードネーム: `advena` (アドヴェナ)
4+
コードネーム: advena (アドヴェナ)
55
</p>
66

77
## Preparing for development
@@ -53,6 +53,16 @@ mr fe:test
5353
mr be:test
5454
```
5555

56+
run tasks in parallel:
57+
58+
```bash
59+
# frontend and backend
60+
mr fe:dev ::: be:dev
61+
62+
# format and test
63+
mr fe:format ::: be:format ::: fe:test ::: be:test
64+
```
65+
5666
### Add dependencies
5767

5868
frontend uses [pnpm](https://github.com/pnpm/pnpm):

backend/genai/.dockerignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# DO NOT include .env.keys (private key) in the image
2+
.env.keys
3+
4+
.git/
5+
.venv/
6+
venv/
7+
8+
# other files
9+
.DS_Store
10+
Dockerfile
11+
README.md
12+
*.pyc
13+
*.pyo
14+
*.pyd
15+
16+
# caches
17+
__pycache__/
18+
.pytest_cache/
19+
.ruff_cache/
20+
.mypy_cache/
21+
22+
# IDE and virtual environment
23+
.idea/
24+
.vscode/
25+
26+
# unused files
27+
tests/
28+
build/
29+
private/
30+
refs/

backend/genai/.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#/-------------------[DOTENV_PUBLIC_KEY]--------------------/
2+
#/ public-key encryption for .env files /
3+
#/ [how it works](https://dotenvx.com/encryption) /
4+
#/----------------------------------------------------------/
5+
DOTENV_PUBLIC_KEY="039cb566a5d9f480085ee02c81f5b9109b52af143ac387c773703ee838c4b2a13d"
6+
7+
# .env
8+
TEST="encrypted:BIzgG7sGAuRySbVjDoiyTHoD/fdqpEnl2S7w42US+vDUQqMnyz4Zvjt30HRc2DlnpDR6iEjTaR1sbU7JRFAxED9WALPY92acUD0xZf7M5XFJ3HqZ+x+92XKuwSRxCF7NW15ZbWBb"

backend/genai/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Python-generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
9+
# Virtual environments
10+
.venv
11+
12+
# python tools
13+
.mypy_cache
14+
.pytest_cache
15+
.ruff_cache
16+
.uv
17+
18+
# dotenvx
19+
.env.keys
20+
21+
# private
22+
private/
23+
refs/

backend/genai/Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Deploy to Google Cloud Run
2+
# see: https://github.com/astral-sh/uv-docker-example/blob/main/multistage.Dockerfile
3+
4+
# First, build the application in the `/app` directory.
5+
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS builder
6+
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
7+
WORKDIR /app
8+
RUN --mount=type=cache,target=/root/.cache/uv \
9+
--mount=type=bind,source=uv.lock,target=uv.lock \
10+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
11+
uv sync --frozen --no-install-project --no-dev
12+
ADD . /app
13+
RUN --mount=type=cache,target=/root/.cache/uv \
14+
uv sync --frozen --no-dev
15+
16+
# Then, use a final image without uv
17+
FROM python:3.13-slim-bookworm
18+
# It is important to use the image that matches the builder, as the path to the
19+
# Python executable must be the same, e.g., using `python:3.11-slim-bookworm`
20+
# will fail.
21+
22+
WORKDIR /app
23+
24+
# Install dotenvx
25+
RUN apt-get update && apt-get install -y curl
26+
RUN curl -sfS https://dotenvx.sh > install.sh && chmod +x install.sh && ./install.sh --directory=. && rm install.sh
27+
28+
# Copy the application from the builder
29+
COPY --from=builder --chown=app:app /app /app
30+
31+
# Place executables in the environment at the front of the path
32+
ENV PATH="/app/.venv/bin:$PATH"
33+
34+
# see: https://dotenvx.com/docs/platforms/docker
35+
CMD ["./dotenvx", "run", "--env-file=.env", "--", "uvicorn", "src.index:app", "--host", "0.0.0.0", "--port", "8080"]

backend/genai/pyproject.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,37 @@ dev = [
2020
"pytest>=8.3.4",
2121
"ruff>=0.9.1",
2222
]
23+
24+
25+
[tool.ruff]
26+
exclude = ["dist", ".venv"]
27+
28+
[tool.ruff.lint]
29+
select = [
30+
"E", # pycodestyle errors
31+
"W", # pycodestyle warnings
32+
"F", # pyflakes
33+
"I", # isort
34+
"B", # flake8-bugbear
35+
"C4", # flake8-comprehensions
36+
"UP", # pyupgrade
37+
]
38+
ignore = [
39+
"E501", # line too long, handled by black
40+
"B008", # do not perform function calls in argument defaults
41+
"C901", # too complex
42+
"W191", # indentation contains tabs
43+
]
44+
45+
[tool.ruff.lint.isort]
46+
known-third-party = []
47+
48+
[tool.ruff.lint.pyupgrade]
49+
# Preserve types, even if a file imports `from __future__ import annotations`.
50+
keep-runtime-typing = true
51+
52+
[tool.pytest]
53+
norecursedirs = [".venv", "src/swarm/examples/*"]
54+
55+
[tool.pytest.ini_options]
56+
asyncio_default_fixture_loop_scope = "function" # "class", "module", "package", "session"

backend/genai/uv.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/web/.dockerignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# DO NOT include .env.keys (private key) in the image
2+
.env.keys
3+
4+
.git/
5+
.next/
6+
node_modules/
7+
8+
# other files
9+
.DS_Store
10+
Dockerfile
11+
README.md
12+
13+
# IDE and virtual environment
14+
.idea/
15+
.vscode/
16+
17+
# unused files
18+
private/
19+
refs/

frontend/web/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ yarn-error.log*
4040
# typescript
4141
*.tsbuildinfo
4242
next-env.d.ts
43+
44+
# dotenvx
45+
.env.keys

frontend/web/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Deploy to Google Cloud Run
2+
# see: https://github.com/nextjs/deploy-google-cloud-run/blob/main/Dockerfile
3+
4+
FROM node:lts-alpine AS base
5+
6+
# Stage 1: Install dependencies
7+
FROM base AS deps
8+
WORKDIR /app
9+
COPY package.json pnpm-lock.yaml ./
10+
RUN corepack enable pnpm && pnpm install --frozen-lockfile
11+
12+
# Stage 2: Build the application
13+
FROM base AS builder
14+
WORKDIR /app
15+
COPY --from=deps /app/node_modules ./node_modules
16+
COPY . .
17+
RUN corepack enable pnpm && pnpm run build
18+
19+
# Stage 3: Production server
20+
FROM base AS runner
21+
22+
WORKDIR /app
23+
24+
# Install dotenvx
25+
RUN apk add --no-cache curl
26+
RUN curl -sfS https://dotenvx.sh > install.sh && chmod +x install.sh && ./install.sh --directory=. && rm install.sh
27+
28+
ENV NODE_ENV=production
29+
COPY --from=builder /app/.env ./
30+
31+
COPY --from=builder /app/.next/standalone ./
32+
COPY --from=builder /app/.next/static ./.next/static
33+
34+
EXPOSE 3000
35+
36+
# see: https://dotenvx.com/docs/platforms/docker
37+
CMD ["./dotenvx", "run", "--env-file=.env", "--", "node", "server.js"]

frontend/web/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# web
22

3-
* [ ] isometric design: 原点がずれているバグあり...
4-
* [ ] audio visualizer: 未実装
3+
* [x] isometric design: 原点がずれているバグあり...
4+
* [x] audio visualizer: 未実装
55
* [ ] mv scene: 未実装
6+
* [ ] deploy to cloud run
67

78
---
89

frontend/web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"db:up": "drizzle-kit up"
1919
},
2020
"dependencies": {
21-
"@ai-sdk/google-vertex": "^2.1.0",
21+
"@ai-sdk/google-vertex": "^2.1.1",
2222
"@codemirror/lang-javascript": "^6.2.2",
2323
"@codemirror/lang-python": "^6.1.7",
2424
"@codemirror/state": "^6.5.1",
@@ -65,7 +65,7 @@
6565
"prosemirror-schema-basic": "^1.2.3",
6666
"prosemirror-schema-list": "^1.5.0",
6767
"prosemirror-state": "^1.4.3",
68-
"prosemirror-view": "^1.37.1",
68+
"prosemirror-view": "^1.37.2",
6969
"react": "19.0.0-rc-45804af1-20241021",
7070
"react-dom": "19.0.0-rc-45804af1-20241021",
7171
"react-markdown": "^9.0.3",

0 commit comments

Comments
 (0)