From e82db9739ce7b3f4f38ef08d815785c5c7f00e34 Mon Sep 17 00:00:00 2001 From: Trevor Fitzgerald Date: Sat, 30 Mar 2024 23:30:09 -0400 Subject: [PATCH] CI image ui/build (#74) * ui/build wip * copy assets to where play framework sees as public root * clone outside the dockerfile --- .github/workflows/ci-image.yml | 6 ++++++ conf/ci.conf | 1 + docker/ci.Dockerfile | 17 +++++++++++------ docs/ci-testing.md | 10 +++++++++- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-image.yml b/.github/workflows/ci-image.yml index 9c128203..aa172531 100644 --- a/.github/workflows/ci-image.yml +++ b/.github/workflows/ci-image.yml @@ -21,6 +21,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Checkout lila + uses: actions/checkout@v4 + with: + repository: 'lichess-org/lila' + path: 'repos/lila' + - name: Log in to the Container registry uses: docker/login-action@v3 with: diff --git a/conf/ci.conf b/conf/ci.conf index 833fa906..935c65eb 100644 --- a/conf/ci.conf +++ b/conf/ci.conf @@ -3,4 +3,5 @@ include "version" user.password.bpass.secret = "9qEYN0ThHer1KWLNekA76Q==" +net.site.name = "lila" net.ratelimit = false diff --git a/docker/ci.Dockerfile b/docker/ci.Dockerfile index 2916a5c5..c9177f4a 100644 --- a/docker/ci.Dockerfile +++ b/docker/ci.Dockerfile @@ -1,3 +1,11 @@ +################################################################################## +FROM node:lts-bookworm as node + +RUN npm install --global pnpm +COPY repos/lila /lila +COPY conf/ci.conf /lila/conf/application.conf +RUN /lila/ui/build --clean --debug --split + ################################################################################## FROM mongo:7-jammy as dbbuilder @@ -20,14 +28,10 @@ RUN mongod --fork --logpath /var/log/mongodb/mongod.log --dbpath /seeded \ --tokens ################################################################################## -FROM sbtscala/scala-sbt:eclipse-temurin-jammy-21.0.2_13_1.9.9_3.4.0 as lilabuilder - -RUN apt update && apt install -y git +FROM sbtscala/scala-sbt:eclipse-temurin-alpine-21.0.2_13_1.9.9_3.4.1 as lilabuilder -RUN mkdir /lila +COPY --from=node /lila /lila WORKDIR /lila -RUN git clone --depth 1 https://github.com/lichess-org/lila.git . -COPY conf/ci.conf ./conf/application.conf RUN ./lila stage ################################################################################## @@ -41,6 +45,7 @@ COPY --from=dbbuilder /jdk-21 /jdk-21 COPY --from=lilabuilder /lila/target /lila/target COPY --from=lilabuilder /lila/public /lila/public COPY --from=lilabuilder /lila/conf /lila/conf +COPY --from=node /lila/public /lila/target/universal/stage/public ENV JAVA_HOME=/jdk-21 ENV PATH=/jdk-21/bin:$PATH diff --git a/docs/ci-testing.md b/docs/ci-testing.md index ff52337d..e24dc19a 100644 --- a/docs/ci-testing.md +++ b/docs/ci-testing.md @@ -2,9 +2,17 @@ ```bash docker build -t lila-ci -f docker/ci.Dockerfile . -docker run -it --rm -p 9663:9663 lila-ci +docker run -it --rm -p 9663:9663 --name lichess lila-ci ``` +Visit: + ```bash curl localhost:9663/api/user/lichess ``` + +### Get a shell in the container for debugging: + +```bash +docker exec -it lichess bash +```