feat: add dockerfile

This commit is contained in:
2025-09-23 14:23:30 +08:00
parent e926f521f6
commit 2455fedc2b
2 changed files with 41 additions and 0 deletions

27
Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
# syntax=docker/dockerfile:1
FROM ubuntu:24.04 AS base
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
clang \
clang-tidy \
clang-format \
cmake \
git \
ninja-build \
pkg-config && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY . .
RUN make install || true
RUN make
CMD ["./app"]

View File

@@ -93,6 +93,20 @@ clang-tidy -quiet src/app/main.cpp -- -Iinclude
## 授權 ## 授權
此專案使用 [MIT License](LICENSE)。 此專案使用 [MIT License](LICENSE)。
## Docker
提供的 `Dockerfile` 會以 Ubuntu 24.04 建立開發環境,安裝 `clang``clang-tidy``clang-format` 等工具並執行 `make install``make`。可以使用以下指令建置並執行容器:
```bash
docker build -t cpp-template .
docker run --rm -it cpp-template
```
如果需要掛載原始碼以便互動開發,可使用:
```bash
docker run --rm -it -v "$(pwd)":/app -w /app cpp-template bash
```
## 下一步 ## 下一步
-`src/` 新增更多檔案與模組。 -`src/` 新增更多檔案與模組。
- 依專案需求擴充 Makefile 或 utils 腳本。 - 依專案需求擴充 Makefile 或 utils 腳本。