Skip to content

Commit

Permalink
Adds basic Dockefiles for dev containers (ubuntu+fedora with GNU tool…
Browse files Browse the repository at this point in the history
…set).
  • Loading branch information
aliakatas committed Jan 2, 2025
1 parent d31147c commit 389e0b5
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 0 deletions.
63 changes: 63 additions & 0 deletions dev_containers/Dockerfile.fedora.38
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Recipe to build a Dev image for gcc and gfortran with Boost 1.87.0 (custom-built)
# Build with:
# docker build -t aristos86/dev-fedora38-boost1870:latest -f Dockerfile.fedora.38 .
# Run with:
# docker run -it --rm -v $(pwd):/app aristos86/dev-fedora38-boost1870 /bin/bash

# Stage 1: Build Boost
# Use a lightweight Fedora image as the base
FROM fedora:38 AS build

# Install essential tools for building Boost
# Update the package lists
RUN dnf update -y

# Install essential development tools
RUN dnf install -y \
gcc-c++ \
cmake \
make \
git \
wget \
tar \
&& dnf autoremove -y

# Define Boost version
ENV BOOST_VERSION=1.87.0
ENV BOOST_DIR=boost_1_87_0

# Download and build Boost
RUN wget https://archives.boost.io/release/${BOOST_VERSION}/source/${BOOST_DIR}.tar.gz \
&& tar -xzf ${BOOST_DIR}.tar.gz \
&& cd ${BOOST_DIR} \
&& ./bootstrap.sh \
&& ./b2 install --prefix=/opt/boost --without-python cxxstd=17 link=shared runtime-link=shared

# Stage 2: Final Image
FROM fedora:38

# Install runtime dependencies
RUN dnf update -y
RUN dnf install -y \
gcc-c++ \
gcc-gfortran \
cmake \
make \
git \
vim \
&& dnf autoremove -y \
&& dnf clean all \
&& rm -rf /var/cache/dnf

# Copy Boost from the build stage
COPY --from=build /opt/boost /opt/boost

# Add Boost to environment variables
ENV BOOST_ROOT=/opt/boost
ENV LD_LIBRARY_PATH=/opt/boost/lib
ENV PATH=/opt/boost/bin:$PATH

# Add a non-root user for development
RUN useradd -ms /bin/bash devuser
USER devuser
WORKDIR /home/devuser
57 changes: 57 additions & 0 deletions dev_containers/Dockerfile.ubuntu.22.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Recipe to build a Dev image for gcc and gfortran with Boost 1.87.0 (custom-built)
# Build with:
# docker build -t aristos86/dev-ubuntu2204-boost1870:latest -f Dockerfile.ubuntu.22.04 .
# Run with:
# docker run -it --rm -v $(pwd):/app aristos86/dev-ubuntu2204-boost1870 /bin/bash

# Stage 1: Build Boost
FROM ubuntu:22.04 AS build

# Install essential tools for building Boost
RUN apt-get update && apt-get install -y \
build-essential \
gcc \
gfortran \
wget \
tar \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Define Boost version
ENV BOOST_VERSION=1.87.0
ENV BOOST_DIR=boost_1_87_0

# Download and build Boost
RUN wget https://archives.boost.io/release/${BOOST_VERSION}/source/${BOOST_DIR}.tar.gz \
&& tar -xzf ${BOOST_DIR}.tar.gz \
&& cd ${BOOST_DIR} \
&& ./bootstrap.sh \
&& ./b2 install --prefix=/opt/boost --without-python cxxstd=17 link=shared runtime-link=shared

# Stage 2: Final Image
FROM ubuntu:22.04

# Install runtime dependencies
RUN apt-get update && apt-get install -y \
build-essential \
gcc \
gfortran \
cmake \
ninja-build \
git \
vim \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Copy Boost from the build stage
COPY --from=build /opt/boost /opt/boost

# Add Boost to environment variables
ENV BOOST_ROOT=/opt/boost
ENV LD_LIBRARY_PATH=/opt/boost/lib
ENV PATH=/opt/boost/bin:$PATH

# Add a non-root user for development
RUN useradd -ms /bin/bash devuser
USER devuser
WORKDIR /home/devuser
63 changes: 63 additions & 0 deletions dev_containers/Dockerfile.ubuntu.22.04-oneapi.2024.2.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Recipe to build a Dev image for oneAPI 2024.2.1 with Boost 1.87.0 (custom-built)
# Build with:
# docker build -t aristos86/dev-ubuntu2204-boost1870-oneapi202421:latest -f Dockerfile.ubuntu.22.04-oneapi.2024.2.1 .
# Run with:
# docker run -it --rm -v $(pwd):/app aristos86/dev-ubuntu2204-boost1870-oneapi202421 /bin/bash

# Stage 1: Build Boost
FROM intel/hpckit:2024.2.1-0-devel-ubuntu22.04 AS build

# Install essential tools for building Boost
RUN apt-get update && apt-get install -y \
build-essential \
gcc \
gfortran \
wget \
tar \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Define Boost version
ENV BOOST_VERSION=1.87.0
ENV BOOST_DIR=boost_1_87_0

# Download and build Boost
RUN wget https://archives.boost.io/release/${BOOST_VERSION}/source/${BOOST_DIR}.tar.gz \
&& tar -xzf ${BOOST_DIR}.tar.gz \
&& cd ${BOOST_DIR} \
&& ./bootstrap.sh \
&& ./b2 install --prefix=/opt/boost --without-python cxxstd=17 link=shared runtime-link=shared




# # Stage 2: Final Image
# FROM intel/hpckit:2024.2.1-0-devel-ubuntu22.04

# # Install runtime dependencies
# RUN apt-get update && apt-get install -y \
# build-essential \
# gcc \
# gfortran \
# cmake \
# ninja-build \
# git \
# vim \
# && apt-get clean \
# && rm -rf /var/lib/apt/lists/*

# # Copy Boost from the build stage
# COPY --from=build /opt/boost /opt/boost

# # Add Boost to environment variables
# ENV BOOST_ROOT=/opt/boost
# ENV LD_LIBRARY_PATH=/opt/boost/lib
# ENV PATH=/opt/boost/bin:$PATH

# # Add a non-root user for development
# RUN useradd -ms /bin/bash devuser
# USER devuser
# WORKDIR /home/devuser



0 comments on commit 389e0b5

Please sign in to comment.