I finally managed to do what I want using the installer approach from Jack 
Firth's Dockerfile:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
################
# DEBIAN IMAGE #
################
FROM debian:jessie

########
# META #
########
MAINTAINER "Zelphir Kaltstahl <zelphirkaltst...@gmail.com>"

#########################
# ENVIRONMENT VARIABLES #
#########################
ENV SHELL=/bin/bash
ARG ROOT_USER=root
ARG DEBIAN_FRONTEND=noninteractive
ARG NON_PRIVILEGED_USER=app
ARG NON_PRIVILEGED_USER_GROUP=app
ARG NON_PRIVILEGED_USER_PASSWORD="yourpw"
ENV HOME="/home/${NON_PRIVILEGED_USER}"

###################
# SYSTEM PACKAGES #
###################
USER $ROOT_USER
RUN apt-get update
RUN apt-get --yes upgrade
# --no-install-recommends\
RUN apt-get --yes dist-upgrade \
 && apt-get install -y \
    wget \
    sqlite3 \
    openssl \
    ca-certificates \
    sudo \
    locales \
    git \
    bzip2 \
    unzip
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*
##############
# SET LOCALE #
##############
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && 
\
    echo 'LANG="en_US.UTF-8"' > /etc/default/locale && \
    dpkg-reconfigure --frontend=noninteractive locales && \
    update-locale LANG=en_US.UTF-8

#################
# ADDING A USER #
#################
# For more info please check useradd --help or man useradd.
RUN groupadd -r $NON_PRIVILEGED_USER_GROUP -g 1000 \
 && useradd \
    --uid 1000 \
    --system \
    --gid $NON_PRIVILEGED_USER_GROUP \
    --create-home \
    --home-dir /home/$NON_PRIVILEGED_USER/ \
    --shell /bin/bash \
    --comment "non-privileged user" \
    $NON_PRIVILEGED_USER \
 && chmod 755 /home/$NON_PRIVILEGED_USER/ \
 && echo "$NON_PRIVILEGED_USER:$NON_PRIVILEGED_USER_PASSWORD" | chpasswd

###################
# INITIAL WORKDIR #
###################
WORKDIR $HOME

##########
# RACKET #
##########
USER $NON_PRIVILEGED_USER

ARG 
RACKET_INSTALLER_CHECKSUM="85cbff83f202293b6cd4c3c58e97919fd75a963177ae815a0e9186886ca4fc54"
ARG RACKET_INSTALLER_FILENAME="racket-install.sh"
ARG RACKET_VERSION="6.11"
ARG 
RACKET_INSTALLER_URL="https://mirror.racket-lang.org/installers/${RACKET_VERSION}/racket-minimal-${RACKET_VERSION}-x86_64-linux.sh";
# download
RUN wget --output-document=$RACKET_INSTALLER_FILENAME -q 
$RACKET_INSTALLER_URL \
 && printf "${RACKET_INSTALLER_CHECKSUM} ${RACKET_INSTALLER_FILENAME}" | 
sha256sum -c - \
 && printf "no\n3\n" | /bin/bash racket-install.sh
# cleanup
RUN rm racket-install.sh
# setup
WORKDIR racket/bin
RUN chmod +x racket
RUN chmod +x raco
RUN printf "b"
ENV PATH=$HOME/racket/bin:$PATH
RUN printf "%s\n" $PATH
# RUN which racket
RUN raco setup
RUN raco pkg config --set catalogs\
    "https://download.racket-lang.org/releases/$RACKET_VERSION/catalog/"\
    "https://pkg-build.racket-lang.org/server/built/catalog/"\
    "https://pkgs.racket-lang.org"\
    "https://planet-compats.racket-lang.org";

###################
# RACKET PACKAGES #
###################
USER $NON_PRIVILEGED_USER
RUN yes | raco pkg install --auto --jobs 4 markdown
RUN yes | raco pkg install --auto --jobs 4 yaml
RUN yes | raco pkg install --auto --jobs 4 pollen
RUN yes | raco pkg install --auto --jobs 4 gregor
RUN yes | raco pkg install --auto --jobs 4 sha

#####################
# INSTALL MINICONDA #
#####################
USER $NON_PRIVILEGED_USER
WORKDIR $HOME

ARG MINICONDA_VERSION="4.3.30"
ENV 
MINICONDA_SHA256SUM="66c822dfe76636b4cc2ae5604816e0e723aa01620f50087f06410ecf5bfdf38c"
ENV CONDA_DIR $HOME/anaconda
ENV PATH $CONDA_DIR/bin:$PATH

RUN mkdir --parents $CONDA_DIR \
 && wget --quiet 
https://repo.continuum.io/miniconda/Miniconda3-$MINICONDA_VERSION-Linux-x86_64.sh
 
\
 && echo "${MINICONDA_SHA256SUM} 
Miniconda3-$MINICONDA_VERSION-Linux-x86_64.sh" | sha256sum -c - \
 && /bin/bash Miniconda3-$MINICONDA_VERSION-Linux-x86_64.sh -f -b -p 
$CONDA_DIR \
 && rm Miniconda3-$MINICONDA_VERSION-Linux-x86_64.sh \
 && $CONDA_DIR/bin/conda config --system --add channels conda-forge \
 && $CONDA_DIR/bin/conda config --system --set auto_update_conda false \
 && conda clean -tips --yes

###################
# PYTHON PACKAGES #
###################
RUN conda install --yes --quiet pygments

#############
# COPY BLOG #
#############
COPY blog $HOME/blog

############
# FINALIZE #
############
USER $NON_PRIVILEGED_USER
WORKDIR $HOME/blog
# ENTRYPOINT ["tini", "--"]

# TODO: Why are variables not working in the CMD directive of Dockerfiles?
CMD ["/home/app/racket/bin/racket", "server.rkt"]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note that I had to switch to `printf` instead of `echo` for the Racket 
installer, because of problems when using `echo`. It would always choose 
`yes` and the default option, when I used `echo`. Or maybe that was when I 
tried it with Alpine and it only got carried over to the Debian attempt.

I am not sure why I could not use environment variables in the `CMD` 
directive of the Dockerfile, so there the user name should be adapted.

I installed `pygments`, because the Racket `markdown` package uses this to 
render code blocks and I use code blocks in my blog posts.

Downloaded installers are checked with SHA256 checksums (miniconda install 
and racket installer).

The image inherits from `debian:jessie`, because I could not find a 
Dockerfile for `philcryer/wheezy`, only instructions of how to get such an 
image and those are not under version control, so I decided to make 
something that is from a base image and can be under version control.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to