From fe6ea460249f4380fc0e7dc99d64ba6332e2b9a2 Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Kandula Date: Thu, 19 Oct 2023 06:58:16 +0530 Subject: [PATCH] chore: Use Docker base images to build (#28198) This will use the Appsmith base image which contains all the downloads needed, so the image build in daily CI should be much more reliable, and quite likely much faster. All workflows have already been updated to use the BASE build argument to set the base image. Once this is merged, building the Docker image will fail if `BASE` build argument is not passed. This is that the base is set explicitly everywhere to not cause any confusion. The deleted content has been moved to https://github.com/appsmithorg/appsmith/blob/8d34a2ac280e2263851fd24e720d26811545b625/deploy/docker/base.dockerfile, which builds the `base-*:*` images. --- .github/workflows/docker-base-image.yml | 2 + Dockerfile | 67 +------------------------ 2 files changed, 4 insertions(+), 65 deletions(-) diff --git a/.github/workflows/docker-base-image.yml b/.github/workflows/docker-base-image.yml index f90728eb20..1614b67881 100644 --- a/.github/workflows/docker-base-image.yml +++ b/.github/workflows/docker-base-image.yml @@ -2,6 +2,8 @@ name: Docker Base Image on: workflow_dispatch: + schedule: + - cron: "0 5 * * MON" jobs: build-docker: diff --git a/Dockerfile b/Dockerfile index 25da3b208b..4af1d28854 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,68 +1,5 @@ -FROM ubuntu:20.04 - -LABEL maintainer="tech@appsmith.com" - -# Set workdir to /opt/appsmith -WORKDIR /opt/appsmith - -# The env variables are needed for Appsmith server to correctly handle non-roman scripts like Arabic. -ENV LANG C.UTF-8 -ENV LC_ALL C.UTF-8 - -# Update APT packages - Base Layer -RUN apt-get update \ - && apt-get upgrade --yes \ - && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes \ - supervisor curl cron nfs-common nginx nginx-extras gnupg wget netcat openssh-client \ - gettext \ - python3-pip python3-venv git ca-certificates \ - && pip install --no-cache-dir git+https://github.com/coderanger/supervisor-stdout@973ba19967cdaf46d9c1634d1675fc65b9574f6e \ - && python3 -m venv --prompt certbot /opt/certbot/venv \ - && /opt/certbot/venv/bin/pip install --upgrade certbot setuptools pip \ - && ln -s /opt/certbot/venv/bin/certbot /usr/local/bin \ - && apt-get remove --yes git python3-pip python3-venv \ - && apt-get autoremove --yes - -# Install MongoDB v5.0.14, Redis, PostgreSQL v13 -RUN curl --silent --show-error --location https://www.mongodb.org/static/pgp/server-5.0.asc | apt-key add - \ - && echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list \ - && echo "deb http://apt.postgresql.org/pub/repos/apt $(grep CODENAME /etc/lsb-release | cut -d= -f2)-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list \ - && curl --silent --show-error --location https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ - && apt update \ - && apt-get install --no-install-recommends --yes mongodb-org redis postgresql-13 \ - && apt-get clean - -# Install Java -RUN set -o xtrace \ - && mkdir -p /opt/java \ - # Assets from https://github.com/adoptium/temurin17-binaries/releases - && version="$(curl --write-out '%{redirect_url}' 'https://github.com/adoptium/temurin17-binaries/releases/latest' | sed 's,.*jdk-,,')" \ - && curl --location --output /tmp/java.tar.gz "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-$version/OpenJDK17U-jdk_$(uname -m | sed s/x86_64/x64/)_linux_hotspot_$(echo $version | tr + _).tar.gz" \ - && tar -xzf /tmp/java.tar.gz -C /opt/java --strip-components 1 - -# Install NodeJS -RUN set -o xtrace \ - && mkdir -p /opt/node \ - && file="$(curl -sS 'https://nodejs.org/dist/latest-v18.x/' | awk -F\" '$2 ~ /linux-'"$(uname -m | sed 's/x86_64/x64/; s/aarch64/arm64/')"'.tar.gz/ {print $2}')" \ - && curl "https://nodejs.org/dist/latest-v18.x/$file" | tar -xz -C /opt/node --strip-components 1 - -# Clean up cache file - Service layer -RUN rm -rf \ - /root/.cache \ - /root/.npm \ - /root/.pip \ - /usr/local/share/doc \ - /usr/share/doc \ - /usr/share/man \ - /var/lib/apt/lists/* \ - /tmp/* - -# Define volumes - Service Layer -VOLUME [ "/appsmith-stacks" ] - -# ------------------------------------------------------------------------ -ENV TMP="/tmp/appsmith" -ENV NGINX_WWW_PATH="$TMP/www" +ARG BASE +FROM ${BASE} # Add backend server - Application Layer ARG JAR_FILE=./app/server/dist/server-*.jar