In an attempt at nostalgia, we are going to once again create an S2I builder, this time for a Fortran app. Yes, Fortran. The objective is to make our little chat program a bit more interesting.
cd ~
s2i create fortran-s2i fortran-s2i
cd ~
cat /dev/null > ~/fortran-s2i/Dockerfile
vi ~/fortran-s2i/Dockerfile
Copy the following text and paste it in to the editor.
# fortran-s2i
FROM openshift/base-centos7
LABEL maintainer="Kenneth Evensen <kdevensen@gmail.com>"
ENV BUILDER_VERSION 1.0
LABEL io.k8s.description="Platform for building Fortran apps" \
io.k8s.display-name="builder 1.0.0" \
io.openshift.tags="fortran"
RUN yum install -y gcc-gfortran && \
yum clean all && \
rm -rf /var/cache/yum/*
COPY ./s2i/bin/ /usr/libexec/s2i
RUN chown -R 1001:1001 /opt/app-root
USER 1001
CMD ["/usr/libexec/s2i/usage"]
To exit vi:
shift+z
shift+z
cat /dev/null > ~/fortran-s2i/s2i/bin/assemble
vi ~/fortran-s2i/s2i/bin/assemble
Copy the following into the editor.
#!/bin/bash -e
echo "---> Installing application source..."
cp -Rf /tmp/src/. ./
echo "---> Building application from source..."
gfortran app.f90 -o /opt/app-root/fortran-app
To exit vi:
shift+z
shift+z
cat /dev/null > ~/fortran-s2i/s2i/bin/run
vi ~/fortran-s2i/s2i/bin/run
Copy the following into the editor.
#!/bin/bash -e
exec /opt/app-root/fortran-app $ARGS
To exit vi:
shift+z
shift+z
In the Wetty terminal, change to the gochat-s2i-userYOUR# project space
oc project gochat-s2i-userYOUR#
Create a new build for the Fortran S2I builder image
oc new-build fortran-s2i/ --to=fortran-s2i
Start the new build for the Fortran S2I builder image
oc start-build fortran-s2i --from-dir=fortran-s2i/
oc new-build https://github.com/kevensen/fortran-dice.git --image-stream=fortran-s2i --name=dice --allow-missing-imagestream-tags
In the chat window, try:
//roll
or
//roll-dice2-sides6