Skip to content
Snippets Groups Projects
Commit 56295c21 authored by martin heide's avatar martin heide
Browse files

dockerfile auf debian gebaut, go webserver laeuft auch

parents
No related branches found
No related tags found
No related merge requests found
FROM golang
#ENV RUN_USER=gouser \
# RUN_GROUP=gogroup \
# RUN_HOME=/home/${RUN_USER}
#RUN groupadd -r ${RUN_GROUP} && useradd -g ${RUN_GROUP} -d ${RUN_HOME} -s /bin/bash ${RUN_USER}
RUN mkdir /go/src/web
COPY ./src/web/web.go /go/src/web/web.go
#RUN ls ./src/web
RUN cd /go/src/web \
&& go build
# && GOBIN=/go/bin go install
#&& echo ${PATH}
CMD ["sleep","infinity"]
#CMD ["web"]
File added
version: "3.6"
services:
gowebserver:
build: .
restart: "no"
container_name: "gowebserver"
ports:
- "0.0.0.0:8765:8080"
networks:
- frontend
environment:
maximapassword: "pw123"
networks:
frontend:
name: frontend
#!/bin/bash
docker build -t gotest .
docker run --rm -d --name gotest gotest
docker cp gotest:/go/src/web/web ../maxima/bin/web
docker stop gotest
# 123
Url?input=2%2b3%3b&timeout=3000
package main
import (
"os"
"os/exec"
//"fmt"
//"log"
)
func main() {
cmd := exec.Command("ls", "/go")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Run()
}
package main
import (
//"fmt"
"log"
"net/http"
//"net/url"
"os"
"os/exec"
)
func handler(w http.ResponseWriter, r *http.Request) {
cmd := exec.Command("/opt/maximapool/2017121800/maxima-optimised","-r",r.URL.Query().Get("input"))
cmd.Stdout = w
cmd.Stderr = os.Stderr
cmd.Run()
//fmt.Fprintf(w, r.URL.Query().Get("input") )
}
func main() {
http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":8080", nil))
}
FROM debian
ENV MAXIMAPOOL=/opt/maximapool \
STACK_MAXIMA=/opt/maxima \
MAXIMA_LOCAL_PATH=assStackQuestion/classes/stack/maxima \
MAXIMA_VERSION=5.41.0 \
SBCL_VERSION=1.4.11
RUN SBCL_ARCH=$(dpkg --print-architecture); if [ $SBCL_ARCH = amd64 ]; then SBCL_ARCH=x86-64; fi; echo $SBCL_ARCH > /SBCL_ARCH
# Prerequisites for compiling
RUN apt-get update \
&& apt-get install -y \
bzip2 \
make \
wget \
python3 \
gnuplot \
gettext-base \
ca-certificates \
curl \
texinfo
RUN mkdir -p ${MAXIMAPOOL}
RUN wget https://sourceforge.net/projects/maxima/files/Maxima-source/${MAXIMA_VERSION}-source/maxima-${MAXIMA_VERSION}.tar.gz -O ${MAXIMAPOOL}/maxima-${MAXIMA_VERSION}.tar.gz
RUN wget https://sourceforge.net/projects/sbcl/files/sbcl/${SBCL_VERSION}/sbcl-${SBCL_VERSION}-$(cat /SBCL_ARCH)-linux-binary.tar.bz2 -O ${MAXIMAPOOL}/sbcl-${SBCL_VERSION}-$(cat /SBCL_ARCH)-linux.tar.bz2
# Compile sbcl
RUN cd ${MAXIMAPOOL} \
&& bzip2 -d sbcl-${SBCL_VERSION}-$(cat /SBCL_ARCH)-linux.tar.bz2 \
&& tar -xf sbcl-${SBCL_VERSION}-$(cat /SBCL_ARCH)-linux.tar \
&& rm sbcl-${SBCL_VERSION}-$(cat /SBCL_ARCH)-linux.tar \
&& ls \
&& cd sbcl-${SBCL_VERSION}-$(cat /SBCL_ARCH)-linux \
&& ./install.sh
# Compile maxima
RUN cd ${MAXIMAPOOL} \
&& tar -xf maxima-${MAXIMA_VERSION}.tar.gz \
&& rm maxima-${MAXIMA_VERSION}.tar.gz \
&& cd maxima-${MAXIMA_VERSION} \
&& ./configure \
&& make \
&& make install \
&& make clean
# deinstallieren: wget, curl, python3, make, bzip2,
COPY ${MAXIMA_LOCAL_PATH} ${STACK_MAXIMA}
COPY stack_util_maximapool maximapool-docker/assets/process.conf.template maximapool-docker/assets/optimize.mac maximapool-docker/assets/maximalocal.mac.template ${MAXIMAPOOL}/
RUN VER=$(grep stackmaximaversion ${STACK_MAXIMA}/stackmaxima.mac | grep -oP "\d+") \
&& mkdir -p ${MAXIMAPOOL}/${VER} \
&& mv ${STACK_MAXIMA} ${MAXIMAPOOL}/${VER}/maxima \
&& mkdir -p ${MAXIMAPOOL}/${VER}/tmp/plots/ \
&& mkdir -p ${MAXIMAPOOL}/${VER}/tmp/logs/ \
&& cd ${MAXIMAPOOL}/ \
&& echo "Configuring Maxima for STACK" \
&& VER=$VER sh -c 'envsubst < process.conf.template > ${VER}/process.conf \
&& envsubst < maximalocal.mac.template > ${VER}/maximalocal.mac \
&& echo "Successfully configured Maxima for STACK ${VER}" \
&& echo "Optimizing Maxima (There will be some warnings due to docker container restrictions and strictness of sbcl) ..." \
&& mv ${MAXIMAPOOL}/optimize.mac ${MAXIMAPOOL}/${VER} \
&& cd ${MAXIMAPOOL}/${VER} \
&& maxima -b optimize.mac \
&& echo "Successfully optimized Maxima."'
assStackQuestion @ 12439ff1
Subproject commit 12439ff1a3a16280e115ce1fab4a23b985c90509
assstackquestion 12439ff
stack_util_maximapool 8cfdfee
maximapool-docker febb5c3
maximapool-docker @ cf80c6b8
Subproject commit cf80c6b84246e292172e0c378b1aaba28913dc14
stack_util_maximapool @ 8cfdfee9
Subproject commit 8cfdfee9ec302f2705a93468053039322b7c86af
FROM mathinstitut/pool_amd64
COPY ./bin/web /goweb
CMD ["/goweb"]
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment