Skip to content

Commit

Permalink
Update shell image and github action caching
Browse files Browse the repository at this point in the history
  • Loading branch information
nktpro committed May 5, 2021
1 parent e740712 commit 3a68b9b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 42 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,20 @@ jobs:
with:
path: |
~/.cache
key: coursier-1.4.9-${{ hashFiles('build.sbt') }}
~/.sbt
key: coursier-${{ hashFiles('build.sbt') }}
restore-keys: |
coursier-1.4.9
coursier-
- name: Cache sbt targets
uses: actions/cache@v2
with:
path: |
./target
./**/target
key: target-1.4.9-${{ github.sha }}
key: target-1.5.1-${{ github.sha }}
restore-keys: |
target-1.4.9
target-1.5.1
- name: Login to Docker Hub
uses: docker/login-action@v1
Expand All @@ -76,4 +77,6 @@ jobs:
find . -type d -name target | xargs -I{} du -sh {}
echo "------------------------------------------------------------------"
mkdir -p ~/.sbt ~/.cache
./cli.sh ci_run_in_shell
3 changes: 2 additions & 1 deletion cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ ci_run_in_shell() {
-e "GITHUB_TOKEN=${GITHUB_TOKEN}" \
-e "GITHUB_REF=${GITHUB_REF}" \
-v "${GITHUB_WORKSPACE}:/repo" \
-v "${HOME}/.cache:/root/.cache" \
-v "${HOME}/.cache:/home/runner/.cache" \
-v "${HOME}/.sbt:/home/runner/.sbt" \
"${SHELL_IMAGE}" \
bash -c "./cli.sh ci_run"
}
Expand Down
61 changes: 24 additions & 37 deletions shell/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
FROM shopstic/curl-tar-unzip:1.0.1 as dumb-init
FROM shopstic/bin-dumb-init:1.2.2 as bin-dumb-init
FROM shopstic/bin-jq:1.6.0 as bin-jq
FROM shopstic/curl-tar-unzip:1.0.1 as sbt

ENV DUMB_INIT_VERSION "1.2.2"

RUN \
curl -Lo /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_amd64 && \
chmod +x /usr/bin/dumb-init

FROM openjdk:11.0.10-buster as sbt

ENV SBT_VERSION "1.5.0"
ENV SCALA_VERSION=2.13.5

ENV PATH="$PATH:/sbt/bin"
ENV SBT_VERSION "1.5.1"

RUN \
mkdir /sbt && \
Expand All @@ -20,17 +11,9 @@ RUN \
unzip sbt.zip && rm -Rf sbt.zip && rm -Rf sbt/lib && mv /sbt/sbt/* /sbt/ && rm -Rf sbt && \
chmod a+x /sbt/bin/sbt

RUN \
mkdir ~/temp && \
cd ~/temp && \
mkdir -p ./src/main/scala && \
touch ./src/main/scala/temp.scala && \
sbt "set scalaVersion := \"${SCALA_VERSION}\"" compile && \
rm -Rf ~/temp

FROM shopstic/curl-tar-unzip:1.0.1 as fdb

ENV FDB_VERSION "6.2.29"
ENV FDB_VERSION "6.2.30"

RUN \
curl -Lko /usr/bin/fdb-clients.deb https://www.foundationdb.org/downloads/${FDB_VERSION}/ubuntu/installers/foundationdb-clients_${FDB_VERSION}-1_amd64.deb && \
Expand All @@ -49,14 +32,6 @@ RUN \
RUN \
mvn deploy:help

FROM shopstic/curl-tar-unzip:1.0.1 as jq

ENV JQ_VERSION "1.6"

RUN \
curl -Lo /usr/bin/jq https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 && \
chmod +x /usr/bin/jq

FROM openjdk:11.0.10-buster

RUN \
Expand All @@ -66,26 +41,38 @@ RUN \

ENV PATH="$PATH:/sbt/bin:/mvn/bin"

COPY --from=dumb-init /usr/bin/dumb-init /usr/bin/dumb-init
COPY --from=bin-dumb-init / /
COPY --from=bin-jq / /
COPY --from=sbt /sbt /sbt
COPY --from=sbt /root/.sbt /root/.sbt
COPY --from=maven /mvn /mvn
COPY --from=maven /root/.m2 /root/.m2
COPY --from=fdb /usr/bin/fdb-clients.deb /usr/bin/fdb-clients.deb
COPY --from=fdb /usr/bin/fdb-server.deb /usr/bin/fdb-server.deb
COPY --from=jq /usr/bin/jq /usr/bin/jq

RUN \
apt-get install /usr/bin/fdb-clients.deb -y && \
apt-get install /usr/bin/fdb-server.deb -y && \
rm -f /usr/bin/fdb-clients.deb && \
rm -f /usr/bin/fdb-server.deb

COPY ./.profile /root/.profile
COPY ./settings.xml /root/.m2/settings.xml
ARG RUNNER_UID=1001
ARG RUNNER_GID=121

RUN \
(groupadd --gid "${RUNNER_GID}" runner || true) && \
useradd --home-dir /home/runner --create-home --uid "${RUNNER_UID}" \
--gid "${RUNNER_GID}" --shell /bin/bash --skel /dev/null runner

COPY ./.profile /home/runner/.profile
COPY ./settings.xml /home/runner/.m2/settings.xml

RUN \
chown "${RUNNER_UID}:${RUNNER_GID}" /home/runner/.profile

USER "${RUNNER_UID}:${RUNNER_GID}"

RUN \
echo "" >> /root/.profile && \
echo "export PATH=\"$PATH\"" >> /root/.profile
echo "" >> /home/runner/.profile && \
echo "export PATH=\"$PATH\"" >> /home/runner/.profile

ENTRYPOINT ["/usr/bin/dumb-init", "--"]

0 comments on commit 3a68b9b

Please sign in to comment.