---
# System prepended metadata

title: EFIT

---

# EFIT

## Build流程

1. 先clone專案到資料夾
```=
mkdir <custom_name>
cd <custom_name>
git clone https://github.com/FIRST-fusion/EFIT.git
```

2. 建立Dockerfile並放在專案資料夾底下

- EFIT
    - bin
    - build
    - Dockerfile
    - ...

![image](https://hackmd.io/_uploads/BkBRkpqAa.png)


Dockerfile
```=Dockerfile
# 使用 Ubuntu 
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
# 安裝所需的套件
RUN apt-get update && apt-get install -y \
    build-essential \
    cmake \
    gfortran \
    libblas-dev \
    liblapack-dev \
    liblapacke-dev \
    libopenblas-dev \
    git

RUN find /usr -name "libblas.so*" -or -name "liblapack.so*"
# 設置環境變量，指定 EFIT 根目錄
ENV EFIT_ROOT /efit


# 創建 EFIT 目錄
RUN mkdir -p $EFIT_ROOT

# 設置工作目錄
WORKDIR $EFIT_ROOT

# 將程式碼放入目錄
COPY . $EFIT_ROOT

# 創建構建目錄並進入該目錄
# RUN mkdir build && cd build


# make
# RUN cmake .. && make
# RUN rm -rf build && mkdir build && cd build && cmake .. && make
RUN rm -rf build && mkdir build && cd build && \
    cmake .. -DBLAS_LIBRARIES=/usr/lib/x86_64-linux-gnu/libblas.so \
             -DLAPACK_LIBRARIES=/usr/lib/x86_64-linux-gnu/liblapack.so && \
    make

# 設置容器啟動時運行的命令
CMD ["/bin/bash"]
```

3. Build Image and Run Container

```=
docker build --no-cache -t <custom_name> .
docker run -it efit-app
```

4. 進入 Container
```=
cd efit
cmake ..
make
```

5. 可看到執行檔
![image](https://hackmd.io/_uploads/SyHckTqC6.png)


6. 離開 Container
```=
exit
```
