Compare commits

...

2 Commits

Author SHA1 Message Date
Manuel 1205933acd
Update images and reduce their size (#13)
* Allow container to be run with custom command

* Reduce language image sizes

* Update OpenJDK to latest version

* Use swc for TypeScript and don't print by default

* Update Haskell image and use stable Debian slim

* Fix formatting and revert TS changes
2021-05-31 00:20:21 -04:00
Manuel e54e191f1b
Check if image exists before building (#12) 2021-05-20 23:53:13 -04:00
12 changed files with 33 additions and 26 deletions

View File

@ -34,4 +34,4 @@ COPY --from=build /opt/myriad .
EXPOSE 8081
CMD ["./myriad"]
ENTRYPOINT ["./myriad"]

View File

@ -16,4 +16,4 @@ COPY --from=build /tmp/myriad .
EXPOSE 8081
CMD ["./myriad"]
ENTRYPOINT ["./myriad"]

View File

@ -1,12 +1,12 @@
FROM alpine AS build
RUN apk update && apk add g++
COPY bf.cpp .
RUN g++ bf.cpp -o bf
RUN apk add --no-cache g++ && \
g++ bf.cpp -o bf
FROM alpine
LABEL author="1Computer1"
RUN apk update && apk add libstdc++
RUN apk add --no-cache libstdc++
COPY --from=build bf /usr/local/bin/
COPY run.sh /var/run/

View File

@ -1,7 +1,6 @@
FROM alpine
LABEL author="1Computer1"
RUN apk update
RUN apk add gcc libc-dev
RUN apk add --no-cache gcc libc-dev
COPY run.sh /var/run/

View File

@ -1,7 +1,6 @@
FROM alpine
LABEL author="1Computer1"
RUN apk update
RUN apk add g++
RUN apk add --no-cache g++
COPY run.sh /var/run/

View File

@ -1,14 +1,17 @@
FROM debian:stretch
FROM debian:stable-slim
LABEL author="1Computer1"
ENV LANG C.UTF-8
RUN apt-get update && \
apt-get install -y --no-install-recommends gnupg dirmngr && \
echo 'deb http://downloads.haskell.org/debian stretch main' > /etc/apt/sources.list.d/ghc.list && \
apt-get install -y --no-install-recommends gnupg dirmngr ca-certificates && \
echo 'deb https://downloads.haskell.org/debian stretch main' > /etc/apt/sources.list.d/ghc.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \
apt-get update && \
apt-get install -y --no-install-recommends ghc-8.6.5
apt-get install -y --no-install-recommends ghc-9.0.1 && \
apt-get purge -y gnupg dirmngr ca-certificates && \
apt-get autoremove -y && \
apt-get autoclean -y
ENV PATH /opt/ghc/8.6.5/bin:$PATH
ENV PATH /opt/ghc/9.0.1/bin:$PATH
COPY run.sh /var/run/

View File

@ -2,6 +2,7 @@ FROM alpine:latest
RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk update && \
apk add idris@testing
apk add idris@testing && \
rm -rf /var/cache/apk/*
COPY run.sh /var/run/

View File

@ -1,4 +1,4 @@
FROM openjdk:13-alpine
FROM openjdk:17-alpine
LABEL author="1Computer1"
COPY run.sh /var/run/

View File

@ -1 +1 @@
cat | node -p
cat | node

View File

@ -1,6 +1,5 @@
FROM alpine
RUN apk update
RUN apk add lua5.3
RUN apk add --no-cache lua5.3
COPY run.sh /var/run/

View File

@ -1,4 +1,4 @@
cat > program.ts
tsc --lib DOM,ESNext --target ES2019 --strict \
--skipLibCheck --types /usr/local/share/.config/yarn/global/node_modules/@types/node program.ts \
&& cat program.js | node -p
&& cat program.js | node

View File

@ -40,13 +40,19 @@ data EvalResult
buildImage :: Language -> Myriad ()
buildImage lang = do
env <- ask
logInfo ["Building image ", cs $ imageName lang]
exec_ ["docker build -t ", imageName lang, " ", cs (env ^. #languagesDir) </> cs (lang ^. #name)]
setupQSems
logInfo ["Built image ", cs $ imageName lang]
when (env ^. #config % #prepareContainers) . void $ setupContainer lang
logInfo ["Checking for image ", cs $ imageName lang]
res <- try $ exec ["docker images -q ", imageName lang]
case res of
Left (SomeException err) -> logError ["An exception occured when checking for image ", cs $ imageName lang, ":\n", cs $ show err]
Right s -> do
when (BL.null s) . void $ do -- If string is empty that means the image does not yet exist
logInfo ["Building image ", cs $ imageName lang]
exec_ ["docker build -t ", imageName lang, " ", cs (env ^. #languagesDir) </> cs (lang ^. #name)]
logInfo ["Built image ", cs $ imageName lang]
setupQSems
when (env ^. #config % #prepareContainers) . void $ setupContainer lang
where
setupQSems :: Myriad ()
setupQSems :: Myriad ()
setupQSems = do
env <- ask
csem <- newQSem 1 -- We only want one container to be set up at a time