Skip to content

Commit

Permalink
Add epicbox-scala/3 image
Browse files Browse the repository at this point in the history
  • Loading branch information
andrvb committed Jun 22, 2021
1 parent 7c4bc4d commit 1512058
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions epicbox-scala/3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM openjdk:11.0.11-slim
MAINTAINER Stepik Team <[email protected]>

ENV SCALA_VERSION 3.0.0
ENV PATH /opt/scala/bin:$PATH

RUN apt-get update && \
apt-get install -y --no-install-recommends wget && \
rm -rf /var/lib/apt/lists/* && \
wget -O - https://github.com/lampepfl/dotty/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz | tar xfz - -C /opt && \
mv /opt/scala3-$SCALA_VERSION /opt/scala

COPY java_lookup_main.sh /usr/local/bin/java_lookup_main.sh
RUN chmod +x /usr/local/bin/java_lookup_main.sh

RUN useradd -M -d /sandbox sandbox
15 changes: 15 additions & 0 deletions epicbox-scala/3/java_lookup_main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# Grep *.class files in the given directory to find one with psvm method defined
# Usage: java_lookup_main.sh DIRECTORY_PATH

PSVM_REGEX="public static( final)? void main\(java\.lang\.String(\[\]|\.\.\.)\)"

shopt -s nullglob
for f in "$1"/*.class; do
if javap -p "$f" 2> /dev/null | grep -Pq "$PSVM_REGEX"; then
filename=$(basename "$f")
echo -n "${filename%.*}"
exit 0
fi
done
exit 1

0 comments on commit 1512058

Please sign in to comment.