example-Dockerfile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. ################
  2. # DEBIAN IMAGE #
  3. ################
  4. FROM debian:jessie
  5. ########
  6. # META #
  7. ########
  8. MAINTAINER "Zelphir Kaltstahl <zelphirkaltstahl@gmail.com>"
  9. #########################
  10. # ENVIRONMENT VARIABLES #
  11. #########################
  12. ENV SHELL=/bin/bash
  13. ARG ROOT_USER=root
  14. ARG DEBIAN_FRONTEND=noninteractive
  15. ARG NON_PRIVILEGED_USER="your-user-name-here"
  16. ARG NON_PRIVILEGED_USER_GROUP="your-user-group-name-here"
  17. ARG NON_PRIVILEGED_USER_PASSWORD="your-password-here"
  18. ENV HOME="/home/${NON_PRIVILEGED_USER}"
  19. ###################
  20. # SYSTEM PACKAGES #
  21. ###################
  22. USER $ROOT_USER
  23. RUN apt-get update
  24. RUN apt-get --yes upgrade
  25. # --no-install-recommends\
  26. RUN apt-get --yes dist-upgrade \
  27. && apt-get install -y \
  28. wget \
  29. sqlite3 \
  30. openssl \
  31. ca-certificates \
  32. sudo \
  33. locales \
  34. git \
  35. bzip2 \
  36. unzip
  37. RUN apt-get clean
  38. RUN rm -rf /var/lib/apt/lists/*
  39. ##############
  40. # SET LOCALE #
  41. ##############
  42. RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
  43. echo 'LANG="en_US.UTF-8"' > /etc/default/locale && \
  44. dpkg-reconfigure --frontend=noninteractive locales && \
  45. update-locale LANG=en_US.UTF-8
  46. #################
  47. # ADDING A USER #
  48. #################
  49. # For more info please check useradd --help or man useradd.
  50. RUN groupadd -r $NON_PRIVILEGED_USER_GROUP -g 1000 \
  51. && useradd \
  52. --uid 1000 \
  53. --system \
  54. --gid $NON_PRIVILEGED_USER_GROUP \
  55. --create-home \
  56. --home-dir /home/$NON_PRIVILEGED_USER/ \
  57. --shell /bin/bash \
  58. --comment "non-privileged user" \
  59. $NON_PRIVILEGED_USER \
  60. && chmod 755 /home/$NON_PRIVILEGED_USER/ \
  61. && echo "$NON_PRIVILEGED_USER:$NON_PRIVILEGED_USER_PASSWORD" | chpasswd
  62. ###################
  63. # INITIAL WORKDIR #
  64. ###################
  65. WORKDIR $HOME
  66. ##########
  67. # RACKET #
  68. ##########
  69. USER $NON_PRIVILEGED_USER
  70. ARG RACKET_INSTALLER_CHECKSUM="85cbff83f202293b6cd4c3c58e97919fd75a963177ae815a0e9186886ca4fc54"
  71. ARG RACKET_INSTALLER_FILENAME="racket-install.sh"
  72. ARG RACKET_VERSION="6.11"
  73. ARG RACKET_INSTALLER_URL="https://mirror.racket-lang.org/installers/${RACKET_VERSION}/racket-minimal-${RACKET_VERSION}-x86_64-linux.sh"
  74. # download
  75. RUN wget --output-document=$RACKET_INSTALLER_FILENAME -q $RACKET_INSTALLER_URL \
  76. && printf "${RACKET_INSTALLER_CHECKSUM} ${RACKET_INSTALLER_FILENAME}" | sha256sum -c - \
  77. && printf "no\n3\n" | /bin/bash racket-install.sh
  78. # cleanup
  79. RUN rm racket-install.sh
  80. # setup
  81. WORKDIR racket/bin
  82. RUN chmod +x racket
  83. RUN chmod +x raco
  84. RUN printf "b"
  85. ENV PATH=$HOME/racket/bin:$PATH
  86. RUN printf "%s\n" $PATH
  87. # RUN which racket
  88. RUN raco setup
  89. RUN raco pkg config --set catalogs\
  90. "https://download.racket-lang.org/releases/$RACKET_VERSION/catalog/"\
  91. "https://pkg-build.racket-lang.org/server/built/catalog/"\
  92. "https://pkgs.racket-lang.org"\
  93. "https://planet-compats.racket-lang.org"
  94. ###################
  95. # RACKET PACKAGES #
  96. ###################
  97. USER $NON_PRIVILEGED_USER
  98. RUN yes | raco pkg install --auto --jobs 4 markdown
  99. RUN yes | raco pkg install --auto --jobs 4 yaml
  100. RUN yes | raco pkg install --auto --jobs 4 pollen
  101. RUN yes | raco pkg install --auto --jobs 4 gregor
  102. RUN yes | raco pkg install --auto --jobs 4 sha
  103. #####################
  104. # INSTALL MINICONDA #
  105. #####################
  106. USER $NON_PRIVILEGED_USER
  107. WORKDIR $HOME
  108. ARG MINICONDA_VERSION="4.3.30"
  109. ARG MINICONDA_SHA256SUM="66c822dfe76636b4cc2ae5604816e0e723aa01620f50087f06410ecf5bfdf38c"
  110. ENV CONDA_DIR $HOME/anaconda
  111. ENV PATH $CONDA_DIR/bin:$PATH
  112. RUN mkdir --parents $CONDA_DIR \
  113. && wget --quiet https://repo.continuum.io/miniconda/Miniconda3-$MINICONDA_VERSION-Linux-x86_64.sh \
  114. && echo "${MINICONDA_SHA256SUM} Miniconda3-$MINICONDA_VERSION-Linux-x86_64.sh" | sha256sum -c - \
  115. && /bin/bash Miniconda3-$MINICONDA_VERSION-Linux-x86_64.sh -f -b -p $CONDA_DIR \
  116. && rm Miniconda3-$MINICONDA_VERSION-Linux-x86_64.sh \
  117. && $CONDA_DIR/bin/conda config --system --add channels conda-forge \
  118. && $CONDA_DIR/bin/conda config --system --set auto_update_conda false \
  119. && conda clean -tips --yes
  120. ###################
  121. # PYTHON PACKAGES #
  122. ###################
  123. RUN conda install --yes --quiet pygments
  124. #############
  125. # COPY BLOG #
  126. #############
  127. COPY blog $HOME/blog
  128. ############
  129. # FINALIZE #
  130. ############
  131. USER $NON_PRIVILEGED_USER
  132. WORKDIR $HOME/blog
  133. CMD ["/bin/bash", "-c", "racket server.rkt"]