From 916558550afcb2dc1d428611ca1a15ef136a40ef Mon Sep 17 00:00:00 2001 From: Thomas Faingnaert Date: Wed, 27 Sep 2023 15:51:47 +0200 Subject: [PATCH 1/3] Update Dockerfile --- Dockerfile | 22 +++++++++++++++------- docker-compose.yml | 7 ++++++- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3e372de..02fd1c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -# Set the base image. We cannot use alpine as long as we don't get rid of +# Set the base image. We cannot use alpine as long as we don't get rid of # therubyracer. -FROM ruby:2.7.2-slim +FROM ruby:3.1.2-slim # Tag the repository. LABEL org.opencontainers.image.source https://github.com/dodona-edu/dodona @@ -11,12 +11,17 @@ LABEL org.opencontainers.image.source https://github.com/dodona-edu/dodona # Install system packages. RUN apt-get update -RUN apt-get -y install --no-install-recommends \ - build-essential curl git libmariadb-dev +RUN apt-get -y install --no-install-recommends \ + build-essential ca-certificates curl git gnupg libmariadb-dev # Install NodeJS. -RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -RUN apt-get -y install --no-install-recommends nodejs +RUN mkdir -p /etc/apt/keyrings +RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | \ + gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +ENV NODE_MAJOR=20 +RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | \ + tee /etc/apt/sources.list.d/nodesource.list +RUN apt-get update && apt-get -y install --no-install-recommends nodejs RUN npm install -g yarn # Install common ruby packages to leverage docker caching. @@ -58,6 +63,9 @@ RUN sed -i 's+git@github.com:dodona-edu/+https://github.com/dodona-edu/+g' \ RUN sed -i 's/judge-pythia.git/judge-java12.git/' /app/db/seeds.rb RUN sed -i 's/20\.times/2.times/g' /app/db/seeds.rb +RUN yarn build:js +RUN yarn build:css + # Set the initialisation script. RUN chmod +x /app/docker-entrypoint.sh ENTRYPOINT /app/docker-entrypoint.sh @@ -70,4 +78,4 @@ EXPOSE 3000 ################################################################################ # Remove build dependencies. -RUN apt-get purge -y --auto-remove build-essential \ No newline at end of file +RUN apt-get purge -y --auto-remove build-essential diff --git a/docker-compose.yml b/docker-compose.yml index 1d59b83..629b1f2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,8 @@ services: interval: 5s timeout: 1m retries: 12 + volumes: + - data:/var/lib/mysql ports: - "3306:3306" @@ -21,4 +23,7 @@ services: depends_on: - database ports: - - "3000:3000" \ No newline at end of file + - "3000:3000" + +volumes: + data: From 5f5a8895c992dda4a0b29d560d94bd087aed46ff Mon Sep 17 00:00:00 2001 From: Thomas Faingnaert Date: Wed, 27 Sep 2023 15:54:29 +0200 Subject: [PATCH 2/3] Add instructions --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 92c2017..de41cca 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,13 @@ # Dodona docker image This repository contains the files to create a Dodona docker image. A nightly version is published every night based on the develop branch of the main Dodona repo. + +## Usage + +```bash +git clone https://github.com/dodona-edu/dodona +git clone https://github.com/dodona-edu/docker-image +cp docker-image/* dodona/ +cd dodona/ +docker-compose up -d +``` From e32983a6cf1a4cce8632b68cd377db5a3d8d2c27 Mon Sep 17 00:00:00 2001 From: Thomas Faingnaert Date: Thu, 28 Sep 2023 14:28:50 +0200 Subject: [PATCH 3/3] Mount Docker socket --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 629b1f2..61726b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,6 +22,8 @@ services: build: . depends_on: - database + volumes: + - /var/run/docker.sock:/var/run/docker.sock ports: - "3000:3000"