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
8d34a2ac28/deploy/docker/base.dockerfile,
which builds the `base-*:*` images.
This commit is contained in:
Shrikant Sharat Kandula 2023-10-19 06:58:16 +05:30 committed by GitHub
parent fa1d3fb0a2
commit fe6ea46024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 65 deletions

View File

@ -2,6 +2,8 @@ name: Docker Base Image
on:
workflow_dispatch:
schedule:
- cron: "0 5 * * MON"
jobs:
build-docker:

View File

@ -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