Skip to content

Commit

Permalink
Modify dockerfile
Browse files Browse the repository at this point in the history
Update docker files

Update docker files

Update docker files
  • Loading branch information
ajami1331 committed May 16, 2024
1 parent ae68626 commit c74a8b9
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 57 deletions.
18 changes: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,26 @@ RUN dotnet build "sojj.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "sojj.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
FROM base AS prepare-languages
WORKDIR /app
COPY --from=publish /app/publish .

COPY ./scripts /root/scripts
COPY ./scripts/restore/restore-from-apt.sh /root/scripts/restore/restore-from-apt.sh
RUN chmod +x /root/scripts/restore/restore-from-apt.sh
RUN /root/scripts/restore/restore-from-apt.sh

COPY ./scripts/restore /root/scripts/restore
RUN chmod +x /root/scripts/restore/*.sh

RUN chmod +x /root/scripts/*.sh
RUN /root/scripts/restore/restore.sh

RUN /root/scripts/restore.sh
FROM prepare-languages AS final
WORKDIR /app
COPY --from=publish /app/publish .

COPY ./entrypoint.sh /root/entrypoint.sh
COPY ./sandbox.sh /root/sandbox.sh
RUN chmod +x /root/entrypoint.sh
RUN chmod +x /root/sandbox.sh

EXPOSE 5050/tcp

Expand Down
6 changes: 1 addition & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash

if [ -z "$PREFORK" ]; then
PREFORK=1
fi

/usr/bin/sandbox -http-addr 0.0.0.0:5050 -dir ~/sandbox/ -release -file-timeout 30m -pre-fork=$PREFORK &
/root/sandbox.sh

dotnet /app/Sojj.dll
7 changes: 7 additions & 0 deletions sandbox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

if [ -z "$PREFORK" ]; then
PREFORK=1
fi

/usr/bin/sandbox -http-addr 0.0.0.0:5050 -dir ~/sandbox/ -release -file-timeout 30m -pre-fork=$PREFORK &
47 changes: 0 additions & 47 deletions scripts/restore.sh

This file was deleted.

15 changes: 15 additions & 0 deletions scripts/restore/install-bflat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

BFLAT_VERSION=7.0.2

wget https://github.com/bflattened/bflat/releases/download/v${BFLAT_VERSION}/bflat-${BFLAT_VERSION}-linux-glibc-x64.tar.gz

rm -rf /usr/local/bflat

mkdir -p /usr/local/bflat

tar -xzf bflat-${BFLAT_VERSION}-linux-glibc-x64.tar.gz -C /usr/local/bflat

rm -rf bflat-${BFLAT_VERSION}-linux-glibc-x64.tar.gz
7 changes: 7 additions & 0 deletions scripts/restore/install-go-judge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

GO_JUDGE_VERSION=1.8.4

wget https://github.com/criyle/go-judge/releases/download/v${GO_JUDGE_VERSION}/go-judge_${GO_JUDGE_VERSION}_linux_amd64 -O /usr/bin/sandbox && chmod +x /usr/bin/sandbox
15 changes: 15 additions & 0 deletions scripts/restore/install-kotlin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

KOTLIN_VERSION=1.9.24

wget https://github.com/JetBrains/kotlin/releases/download/v${KOTLIN_VERSION}/kotlin-compiler-${KOTLIN_VERSION}.zip

unzip kotlin-compiler-${KOTLIN_VERSION}.zip -d ./tmp_kotlinc

cp -r ./tmp_kotlinc/kotlinc/bin /usr/local/
cp -r ./tmp_kotlinc/kotlinc/lib /usr/local/

rm -rf ./tmp_kotlinc
rm -rf kotlin-compiler-${KOTLIN_VERSION}.zip
19 changes: 19 additions & 0 deletions scripts/restore/restore-from-apt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e

apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
wget \
g++ \
python3 \
mono-runtime \
mono-mcs \
mono-devel \
nodejs \
ruby \
golang \
openjdk-8-jdk-headless \
unzip
9 changes: 9 additions & 0 deletions scripts/restore/restore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -e

/root/scripts/restore/install-go-judge.sh

/root/scripts/restore/install-bflat.sh

/root/scripts/restore/install-kotlin.sh

0 comments on commit c74a8b9

Please sign in to comment.