Compare commits
25 Commits
Author | SHA1 | Date |
---|---|---|
Manuel | eb2040f2fe | |
Manuel | 7822e6ad17 | |
Manuel | b7ae9a1551 | |
Manuel | 459c2dd158 | |
Manuel | 6c153d6bf1 | |
Manuel | 8e04bd9726 | |
Manuel | d9156c574a | |
Manuel | 2dbc049f99 | |
Manuel | 5a9a107cb4 | |
Manuel | ce05a4f680 | |
Manuel | 099c7d11b2 | |
Manuel | a8e2fc1af3 | |
Manuel | e5ac8a9c55 | |
Manuel | 6d6f6f32aa | |
Manuel | 2a9afa5b25 | |
Manuel | 50e1a663c8 | |
Manuel | bbb8dd9646 | |
Manuel | 5858e89fab | |
Manuel | 26e49b3db5 | |
Manuel | 45d28eb237 | |
Manuel | a51b94913a | |
Manuel | 73d3fce78a | |
Manuel | 23bfdb65ab | |
Manuel | bfed6e74a7 | |
Manuel | 1b8c2eea8d |
|
@ -1,5 +1,6 @@
|
|||
module Main where
|
||||
|
||||
import System.IO (BufferMode (NoBuffering), hSetBuffering, stdout)
|
||||
import Options.Applicative
|
||||
import Myriad
|
||||
|
||||
|
@ -31,5 +32,6 @@ parseArgs = execParser $ info (helper <*> args) (fullDesc <> progDesc "Run the M
|
|||
|
||||
main :: IO ()
|
||||
main = do
|
||||
hSetBuffering stdout NoBuffering
|
||||
Args { configPath, languagesDir } <- parseArgs
|
||||
runMyriadServer configPath languagesDir
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
FROM openjdk:17-alpine
|
||||
LABEL author="SunRed"
|
||||
|
||||
RUN apk add --no-cache curl && \
|
||||
curl -O http://lhartikk.github.io/ArnoldC.jar && \
|
||||
mv ArnoldC.jar /var/run && \
|
||||
apk del --no-cache curl
|
||||
|
||||
COPY run.sh /var/run/
|
|
@ -0,0 +1,2 @@
|
|||
cat > program.arnoldc
|
||||
java -jar /var/run/ArnoldC.jar program.arnoldc && java program
|
|
@ -1,12 +1,13 @@
|
|||
FROM alpine AS build
|
||||
FROM alpine as build
|
||||
|
||||
COPY bf.cpp .
|
||||
RUN apk add --no-cache g++ && \
|
||||
g++ bf.cpp -o bf
|
||||
WORKDIR /tmp/bf
|
||||
RUN apk add --no-cache musl-dev gcc make git && \
|
||||
git clone https://github.com/rdebath/Brainfuck.git . && \
|
||||
cd tritium && \
|
||||
make
|
||||
|
||||
FROM alpine
|
||||
LABEL author="1Computer1"
|
||||
LABEL author="SunRed"
|
||||
|
||||
RUN apk add --no-cache libstdc++
|
||||
COPY --from=build bf /usr/local/bin/
|
||||
COPY --from=build /tmp/bf/tritium/bfi.out /usr/local/bin/bf
|
||||
COPY run.sh /var/run/
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
FROM alpine
|
||||
LABEL author="SunRed"
|
||||
|
||||
RUN apk add --no-cache musl-dev gcc ldc
|
||||
|
||||
COPY run.sh /var/run/
|
|
@ -0,0 +1,2 @@
|
|||
cat > program.d
|
||||
ldc2 program.d -of program && ./program
|
|
@ -0,0 +1,57 @@
|
|||
FROM debian:stable-slim as build
|
||||
|
||||
ENV CC clang-8
|
||||
ENV CXX clang++-8
|
||||
ENV DEBIAN_FRONTEND=nontinteractive
|
||||
ENV PYTHONIOENCODING utf8
|
||||
|
||||
RUN \
|
||||
apt-get update && \
|
||||
apt-get install -y \
|
||||
gnupg \
|
||||
wget && \
|
||||
echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list && \
|
||||
echo "deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list && \
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add - && \
|
||||
apt-get update && \
|
||||
apt-get install -y \
|
||||
clang-8 \
|
||||
cmake \
|
||||
libstdc++-8-dev \
|
||||
libclang1-8 \
|
||||
libclang-8-dev \
|
||||
libclang-common-8-dev \
|
||||
libfuzzer-8-dev \
|
||||
libllvm8 \
|
||||
libncurses-dev \
|
||||
libz-dev \
|
||||
llvm-8 \
|
||||
llvm-8-dev \
|
||||
llvm-runtime \
|
||||
ninja-build \
|
||||
python3 \
|
||||
rsync \
|
||||
git && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
mkdir /tmp/emojicode/
|
||||
|
||||
WORKDIR /tmp/emojicode/
|
||||
RUN git clone https://github.com/emojicode/emojicode.git .
|
||||
RUN cmake . -GNinja && \
|
||||
ninja && \
|
||||
ninja magicinstall
|
||||
|
||||
|
||||
FROM debian:stable-slim
|
||||
LABEL author="SunRed"
|
||||
|
||||
ENV CXX=g++
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y ${CXX} && \
|
||||
apt-get autoremove -y && \
|
||||
apt-get autoclean -y
|
||||
|
||||
COPY --from=build /usr/local/bin /usr/local/bin
|
||||
COPY --from=build /usr/local/EmojicodePackages /usr/local/EmojicodePackages
|
||||
COPY run.sh /var/run/
|
|
@ -0,0 +1,2 @@
|
|||
cat > program.emojic
|
||||
emojicodec program.emojic -o program && ./program
|
|
@ -1,4 +1,4 @@
|
|||
FROM node:alpine
|
||||
FROM node:slim
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
FROM alpine as build
|
||||
|
||||
RUN apk add --no-cache build-base git cmake
|
||||
|
||||
WORKDIR /tmp/lci
|
||||
RUN git clone https://github.com/justinmeza/lci.git .
|
||||
|
||||
RUN cmake . && make
|
||||
|
||||
|
||||
FROM alpine
|
||||
LABEL author="SunRed"
|
||||
|
||||
COPY --from=build /tmp/lci/lci /usr/local/bin
|
||||
COPY run.sh /var/run/
|
|
@ -0,0 +1,2 @@
|
|||
cat > program.lol
|
||||
lci program.lol
|
|
@ -0,0 +1,17 @@
|
|||
FROM openjdk:17-alpine
|
||||
LABEL author="SunRed"
|
||||
|
||||
COPY setlX /usr/local/bin/
|
||||
COPY run.sh /var/run/
|
||||
|
||||
RUN apk add --no-cache curl unzip bash && \
|
||||
curl -O https://download.randoom.org/setlX/pc/setlX_v2-7-2.binary_only.zip && \
|
||||
unzip -d setlx setlX_v2-7-2.binary_only.zip && \
|
||||
rm -f setlX_v2-7-2.binary_only.zip && \
|
||||
mkdir -p /usr/local/setlX && \
|
||||
mv setlx/setlX*.jar /usr/local/setlX && \
|
||||
mkdir -p /usr/local/setlXlibrary && \
|
||||
mv setlx/setlXlibrary/* /usr/local/setlXlibrary && \
|
||||
chmod +x /usr/local/bin/setlX && \
|
||||
rm -rf setlx && \
|
||||
apk del --no-cache curl unzip
|
|
@ -0,0 +1,2 @@
|
|||
cat > program.stlx
|
||||
bash /usr/local/bin/setlX ./program.stlx
|
|
@ -0,0 +1,65 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
#
|
||||
# launcher script for the setlX interpreter on Unix-like systems
|
||||
#
|
||||
#
|
||||
|
||||
# insert path to the folder where you copied the jar files here
|
||||
setlXJarDirectory="/usr/local/setlX/"
|
||||
|
||||
# insert full path to library location here
|
||||
setlXlibraryPath="/usr/local/setlXlibrary/"
|
||||
|
||||
############################## additional options ##############################
|
||||
javaParameters=""
|
||||
|
||||
# uncomment to force execution in 64 bit mode
|
||||
#javaParameters="$javaParameters -d64"
|
||||
|
||||
# uncomment to execute with increased memory size (6GB) (>2GB needs 64 Bit mode!)
|
||||
#javaParameters="$javaParameters -Xmx6144m"
|
||||
|
||||
# uncomment to execute with increased stack size
|
||||
#javaParameters="$javaParameters -Xss48m"
|
||||
|
||||
################################################################################
|
||||
|
||||
if [ -n "$OVERRIDE_setlXJarDirectory" ]
|
||||
then
|
||||
setlXJarDirectory="$OVERRIDE_setlXJarDirectory"
|
||||
fi
|
||||
if [ -n "$OVERRIDE_setlXjavaParameters" ]
|
||||
then
|
||||
javaParameters="$OVERRIDE_setlXjavaParameters"
|
||||
fi
|
||||
if [ -z "$SETLX_LIBRARY_PATH" ]
|
||||
then
|
||||
export SETLX_LIBRARY_PATH="$setlXlibraryPath"
|
||||
fi
|
||||
|
||||
java_call="java"
|
||||
|
||||
if [[ -z "$INSIDE_EMACS" && $(which rlwrap > /dev/null 2>&1; echo $?) -eq 0 ]]
|
||||
then
|
||||
java_call="rlwrap -C $(basename $0) $java_call"
|
||||
fi
|
||||
|
||||
jarFiles=""
|
||||
while read -r -d $'\0' jarname
|
||||
do
|
||||
if [ -n "$jarFiles" ]
|
||||
then
|
||||
jarFiles="$jarFiles:"
|
||||
fi
|
||||
jarFiles="$jarFiles${jarname#./}"
|
||||
done < <( find "$setlXJarDirectory" -maxdepth 1 -name "*.jar" -print0 )
|
||||
|
||||
if [ -n "$jarFiles" ]
|
||||
then
|
||||
$java_call -cp "$jarFiles:$CLASSPATH" $javaParameters org.randoom.setlx.pc.ui.SetlX "$@"
|
||||
exit $?
|
||||
else
|
||||
echo "The setlX jar files cannot be found!"
|
||||
exit 1
|
||||
fi
|
|
@ -1,4 +1,4 @@
|
|||
FROM node:alpine
|
||||
FROM node:slim
|
||||
LABEL author="1Computer1"
|
||||
|
||||
RUN yarn global add typescript @types/node
|
||||
|
|
|
@ -95,7 +95,7 @@ initEnv configPath languagesDir =
|
|||
<*> newSnowflakeGen defaultConfig 0
|
||||
|
||||
runMyriadT :: MonadIO m => Env -> MyriadT m a -> m a
|
||||
runMyriadT env = runStdoutLoggingT . flip runReaderT env . unMyriadT
|
||||
runMyriadT env = runStdoutLoggingT . filterLogger (\_ lvl -> lvl /= LevelDebug) . flip runReaderT env . unMyriadT
|
||||
|
||||
exec :: (MonadIO m, MonadLogger m) => [String] -> m BL.ByteString
|
||||
exec args = do
|
||||
|
|
|
@ -83,9 +83,9 @@ startCleanup = do
|
|||
timer t = forever $ do
|
||||
-- Takes time in microseconds
|
||||
threadDelay $ t * 60000000
|
||||
logInfo ["Starting cleanup of containers"]
|
||||
logDebug ["Starting cleanup of containers"]
|
||||
n <- killContainers
|
||||
logInfo ["Cleaned up ", cs $ show n, " containers, next in ", cs $ show t, " minutes"]
|
||||
logDebug ["Cleaned up ", cs $ show n, " containers, next in ", cs $ show t, " minutes"]
|
||||
timer t
|
||||
|
||||
setupContainer :: Language -> Myriad ContainerName
|
||||
|
@ -152,9 +152,9 @@ killContainer lang = do
|
|||
killContainers :: Myriad [ContainerName]
|
||||
killContainers = do
|
||||
containers <- gview #containers >>= readMVar
|
||||
logInfo ["Starting killing of containers"]
|
||||
logDebug ["Starting killing of containers"]
|
||||
xs <- forConcurrently (M.toList containers) $ \(k, v) -> (v,) <$> killContainer k
|
||||
logInfo ["Finished killing of containers"]
|
||||
logDebug ["Finished killing of containers"]
|
||||
pure . map fst $ filter snd xs
|
||||
|
||||
evalCode :: Language -> Int -> String -> Myriad EvalResult
|
||||
|
@ -171,14 +171,14 @@ evalCode lang numRetries code = withContainer $ \cnt -> do
|
|||
if done
|
||||
-- If we find the eval is done from an exception, then it was timed out.
|
||||
then do
|
||||
logInfo ["Code timed out in container ", cs cnt, ", evaluation ", cs $ show snowflake]
|
||||
logDebug ["Code timed out in container ", cs cnt, ", evaluation ", cs $ show snowflake]
|
||||
pure EvalTimedOut
|
||||
-- Otherwise, the container was killed from another eval, so we should retry.
|
||||
else do
|
||||
writeMVar doneRef True
|
||||
if numRetries < fromIntegral (lang ^. #retries)
|
||||
then do
|
||||
logInfo
|
||||
logDebug
|
||||
[ "An exception occured in "
|
||||
, cs cnt
|
||||
, ", evaluation "
|
||||
|
@ -188,7 +188,7 @@ evalCode lang numRetries code = withContainer $ \cnt -> do
|
|||
]
|
||||
evalCode lang (numRetries + 1) code
|
||||
else do
|
||||
logInfo
|
||||
logDebug
|
||||
[ "An exception occured in "
|
||||
, cs cnt
|
||||
, ", evaluation "
|
||||
|
@ -228,7 +228,7 @@ evalCode lang numRetries code = withContainer $ \cnt -> do
|
|||
|
||||
eval :: ContainerName -> Snowflake -> Myriad EvalResult
|
||||
eval cnt snowflake = do
|
||||
logInfo ["Running code in container ", cs cnt, ", evaluation ", cs $ show snowflake, ":\n", cs code]
|
||||
logDebug ["Running code in container ", cs cnt, ", evaluation ", cs $ show snowflake, ":\n", cs code]
|
||||
exec_ ["docker exec ", cs cnt, " mkdir eval/", show snowflake]
|
||||
exec_ ["docker exec ", cs cnt, " chmod 777 eval/", show snowflake]
|
||||
-- User 1001 will be used for the actual execution so that they can't access `eval` itself
|
||||
|
@ -245,7 +245,7 @@ evalCode lang numRetries code = withContainer $ \cnt -> do
|
|||
logDebug ["Executing with stdin `", cs cmd, "`"]
|
||||
output <- readProcessInterleaved_ pr
|
||||
exec_ ["docker exec ", cnt, " rm -rf eval/", show snowflake]
|
||||
logInfo ["Ran code in container ", cs cnt, ", evaluation ", cs $ show snowflake]
|
||||
logDebug ["Ran code in container ", cs cnt, ", evaluation ", cs $ show snowflake]
|
||||
pure $ EvalOk output
|
||||
|
||||
newContainerName :: Language -> Myriad ContainerName
|
||||
|
|
Loading…
Reference in New Issue