forked from LiveEnhancementSuite/LESforMacOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.test
More file actions
70 lines (62 loc) · 2.4 KB
/
Copy pathDockerfile.test
File metadata and controls
70 lines (62 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
###############################################
# LESforMacOS Custom — テスト実行環境
#
# 使い方:
# docker build -f Dockerfile.test -t les-test .
# docker run --rm les-test
#
# Lua テストのみ実行:
# docker run --rm les-test busted extensions/les/tests/
#
# luacheck 静的解析のみ:
# docker run --rm les-test luacheck extensions/les/
#
# シェルに入る:
# docker run --rm -it les-test /bin/sh
###############################################
FROM debian:bookworm-slim
# -------------------------------------------
# システムパッケージ
# -------------------------------------------
RUN apt-get update && apt-get install -y --no-install-recommends \
lua5.4 \
liblua5.4-dev \
luarocks \
gcc \
libc6-dev \
make \
curl \
ca-certificates \
git \
&& rm -rf /var/lib/apt/lists/*
# -------------------------------------------
# Node.js (LTS) + pnpm
# lint / フォーマッタ等の JS ツールチェーン用
# -------------------------------------------
ENV NODE_VERSION=22
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/* \
&& corepack enable \
&& corepack prepare pnpm@latest --activate
# -------------------------------------------
# Lua テスト・静的解析ツール
# -------------------------------------------
# IMPORTANT: pin to Lua 5.4 — Debian's luarocks defaults to Lua 5.1,
# which cannot even parse production code using goto (Lua 5.2+)
RUN luarocks-5.4 install busted \
&& luarocks-5.4 install luacheck
# -------------------------------------------
# アプリケーションコード
# -------------------------------------------
WORKDIR /app
# package.json があれば pnpm install を実行(なくても COPY エラーにならないよう .luacheckrc をフォールバック)
COPY .luacheckrc package.json* pnpm-lock.yaml* ./
RUN if [ -f package.json ]; then pnpm install --frozen-lockfile 2>/dev/null || pnpm install; fi
# Lua ソースとテスト
COPY .luacheckrc ./
COPY extensions/les/ ./extensions/les/
# -------------------------------------------
# デフォルト: 全テスト実行
# -------------------------------------------
CMD ["sh", "-c", "echo '=== luacheck ===' && luacheck extensions/les/ --no-color 2>&1; echo '' && echo '=== busted ===' && busted extensions/les/tests/"]