Add docker related files
This commit is contained in:
parent
61a16ad2cd
commit
6a9959f98d
36
_web_server/Dockerfile
Normal file
36
_web_server/Dockerfile
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM ubuntu:22.10
|
||||||
|
LABEL description="Verilog playground"
|
||||||
|
|
||||||
|
# Prepare OS
|
||||||
|
RUN apt-get -y update \
|
||||||
|
&& apt-get -y install iverilog guile-3.0 locales git
|
||||||
|
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
|
||||||
|
&& locale-gen
|
||||||
|
|
||||||
|
# Environment
|
||||||
|
ENV GIT_SSL_NO_VERIFY=1
|
||||||
|
ENV GUILE_LOAD_PATH=/server/embddr-scheme-library
|
||||||
|
ENV LANG=en_US.UTF-8
|
||||||
|
ENV DONOTUSEFIREJAIL=1
|
||||||
|
|
||||||
|
# Copy server files
|
||||||
|
WORKDIR /server
|
||||||
|
COPY server/* ./
|
||||||
|
RUN git clone https://git.embddr.com/np/embddr-scheme-library.git
|
||||||
|
RUN mkdir play-work /verilog-playground-store
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
VOLUME /verilog-playground-store
|
||||||
|
|
||||||
|
CMD [ "guile", "-e", "main", \
|
||||||
|
"./playground-server.scm", \
|
||||||
|
"--port=8080", \
|
||||||
|
"--addr=0.0.0.0", \
|
||||||
|
"--host=https://play.embddr.com", \
|
||||||
|
"--iverilog-exe=./iverilog", \
|
||||||
|
"--vvp-exe=./vvp", \
|
||||||
|
"--max-len=10000", \
|
||||||
|
"--work-base=play-work", \
|
||||||
|
"--stor-base=/verilog-playground-store", \
|
||||||
|
"--log-level=2" ]
|
||||||
3
_web_server/container-create.sh
Executable file
3
_web_server/container-create.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
docker build -t playground .
|
||||||
45
_web_server/container-run.sh
Executable file
45
_web_server/container-run.sh
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [ 0 -eq "$#" ]; then
|
||||||
|
echo "Usage $0 start/stop/status"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
action=$1
|
||||||
|
container=playground
|
||||||
|
|
||||||
|
case $action in
|
||||||
|
"start")
|
||||||
|
cid=$(docker container ls -q -a -f name=$container)
|
||||||
|
|
||||||
|
if [ -z "$cid" ]; then
|
||||||
|
docker run -d --name $container \
|
||||||
|
-p 127.0.0.1:8089:8080 \
|
||||||
|
-v /srv/playground/storage:/verilog-playground-store \
|
||||||
|
--cpus=1 --memory=16g --memory-swap=16g \
|
||||||
|
$container
|
||||||
|
else
|
||||||
|
docker start $container
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
"stop")
|
||||||
|
# Press twice CRTL-C
|
||||||
|
docker kill -s SIGINT $container
|
||||||
|
docker kill -s SIGINT $container
|
||||||
|
;;
|
||||||
|
|
||||||
|
"status")
|
||||||
|
cid=$(docker container ls -q -f name=$container)
|
||||||
|
|
||||||
|
if [ -z "$cid" ]; then
|
||||||
|
echo "Stopped"
|
||||||
|
else
|
||||||
|
echo "Started"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
"*")
|
||||||
|
echo "Unknown action $action. Actions start, stop and status are allowed"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Loading…
x
Reference in New Issue
Block a user