File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Use the official Ubuntu Jammy-based Dev Container image as a starting point
2+ FROM mcr.microsoft.com/devcontainers/base:jammy
3+
4+ # 1. Install dependencies needed to add Intel’s repo, install CMake, gfortran, and GDB
5+ RUN apt-get update && \
6+ apt-get install -y --no-install-recommends \
7+ wget \
8+ gpg \
9+ lsb-release \
10+ apt-transport-https \
11+ ca-certificates \
12+ cmake \
13+ gdb \
14+ gfortran \
15+ && rm -rf /var/lib/apt/lists/*
16+
17+ # 2. Add Intel’s GPG key and repository for oneAPI
18+ RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
19+ | gpg --dearmor \
20+ | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
21+
22+ RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \
23+ > /etc/apt/sources.list.d/oneAPI.list
24+
25+ # 3. Install Intel oneAPI Fortran Compiler
26+ RUN apt-get update && \
27+ apt-get install -y --no-install-recommends \
28+ intel-oneapi-compiler-fortran \
29+ && rm -rf /var/lib/apt/lists/*
30+
31+ # 4. Source Intel’s setvars script automatically for all users
32+ # (In a dev container, /etc/bash.bashrc is typically read by non-login shells)
33+ RUN echo "source /opt/intel/oneapi/setvars.sh" >> /etc/bash.bashrc
34+
35+ # 5. Prepend ifx path to the global PATH environment
36+ ENV PATH=/opt/intel/oneapi/compiler/2025.0/bin:$PATH
37+ ENV LD_LIBRARY_PATH=/opt/intel/oneapi/compiler/2025.0/lib:$LD_LIBRARY_PATH
38+
39+ # That’s it! The container now has ifx + CMake installed and configured.
Original file line number Diff line number Diff line change 1+ // .devcontainer/devcontainer.json
2+ {
3+ "name" : " Intel Fortran Dev Container" ,
4+ // 1. Build our custom Dockerfile
5+ "build" : {
6+ "dockerfile" : " Dockerfile"
7+ },
8+ "postCreateCommand" : " mkdir -p /workspaces/data_test && cp -r /workspaces/*/data/Ames_sub1 /workspaces/data_test/" ,
9+ // 2. VS Code customizations
10+ "customizations" : {
11+ "vscode" : {
12+ // 2A. Install relevant extensions automatically
13+ "extensions" : [
14+ " ms-vscode.cmake-tools" ,
15+ " fortran-lang.linter-gfortran" ,
16+ " ms-vscode.cpptools" ,
17+ " mhutchie.git-graph" ,
18+ " GitHub.remotehub"
19+ ],
20+ // 2B. VS Code settings for CMake + ifx
21+ "settings" : {
22+ "cmake.cmakePath" : " /usr/bin/cmake" ,
23+ "cmake.configureSettings" : {
24+ // If you want to always use ifx in your CMake configs
25+ "CMAKE_Fortran_COMPILER" : " ifx"
26+ },
27+ "cmake.environment" : {
28+ // Additional environment variables for Fortran
29+ "FC" : " ifx" ,
30+ // Not strictly needed if your Dockerfile sets PATH/LD_LIBRARY_PATH
31+ "PATH" : " /opt/intel/oneapi/compiler/2025.0/bin:${env:PATH}" ,
32+ "LD_LIBRARY_PATH" : " /opt/intel/oneapi/compiler/2025.0/lib:${env:LD_LIBRARY_PATH}"
33+ }
34+ }
35+ }
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments