Skip to content

Commit

Permalink
Add Dockerfile for automatic build
Browse files Browse the repository at this point in the history
  • Loading branch information
Pasquale Africa committed Jul 20, 2021
1 parent d2e2813 commit 9a5d794
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Build with:
# docker build -t mk_build . --squash
#
# Retrieve build files with:
# docker run -it mk_build
# docker container list
# docker cp <container_id>:/mk/mk-2021.0-toolchain.tar.gz .
# docker cp <container_id>:/mk/mk-2021.0-base.tar.gz .
# docker cp <container_id>:/mk/mk-2021.0-full.tar.gz .


FROM debian:latest

MAINTAINER [email protected]


# Define variables.
ENV HOME /root
ENV mkPrefix /u/sw

ENV mkRoot /mk
ENV mkOutputBasename ${mkRoot}/mk-2021.0

ENV mkKeepBuildDir yes
ENV mkFlags "--jobs=6 -v"


# Install dependencies.
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y build-essential python2 python3 \
gawk procps wget curl openssh-client p11-kit \
git rsync zip unzip


# Clone repo.
RUN git clone https://github.com/elauksap/mk.git ${mkRoot}


# 1. Bootstrap
WORKDIR ${mkRoot}
RUN bootstrap/bootstrap ${mkPrefix}

# 2. Toolchain
WORKDIR ${mkRoot}/toolchains/gcc-glibc
RUN make install mkFlags="${mkFlags}"
RUN tar czvf ${mkOutputBasename}-toolchain.tar.gz ${mkPrefix}

# Enable toolchain by default.
SHELL ["/bin/bash", "-c"]
RUN printf "\n# mk.\n\
source /u/sw/etc/profile\n\
module load gcc-glibc\n" >> ${HOME}/.bashrc

# 3. Base
WORKDIR ${mkRoot}/base
RUN source ${HOME}/.bashrc && make install mkFlags="${mkFlags}"
RUN tar czvf ${mkOutputBasename}-base.tar.gz ${mkPrefix}

# 4. Packages
WORKDIR ${mkRoot}/pkgs
RUN source ${HOME}/.bashrc && make install mkFlags="${mkFlags}"
RUN tar czvf ${mkOutputBasename}-full.tar.gz ${mkPrefix}


# Set configuration variables.
USER root
WORKDIR ${HOME}

0 comments on commit 9a5d794

Please sign in to comment.