feat: Support building Docker image for ARM arch (#7832)

This commit is contained in:
geekup-legodevops 2021-09-29 16:03:27 +07:00 committed by GitHub
parent db13282a6f
commit f37f9451ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 28 deletions

View File

@ -1,4 +1,4 @@
FROM debian:buster FROM ubuntu:20.04
LABEL maintainer="tech@appsmith.com" LABEL maintainer="tech@appsmith.com"
@ -9,21 +9,20 @@ WORKDIR /opt/appsmith
ENV LANG C.UTF-8 ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8 ENV LC_ALL C.UTF-8
# Update APK packages - Base Layer # Update APT packages - Base Layer
RUN apt-get update && apt-get install --no-install-recommends -y \ RUN apt-get update && apt-get install --no-install-recommends -y \
supervisor curl cron certbot nginx gnupg \ supervisor curl cron certbot nginx gnupg wget \
redis wget gettext openjdk-11-jre \ software-properties-common gettext openjdk-11-jre \
&& add-apt-repository ppa:redislabs/redis \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install MongoDB v4.0.5, Redis - Service Layer # Install MongoDB v4.0.5, Redis, NodeJS - Service Layer
RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add - RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add -
RUN echo "deb [ arch=amd64,arm64 ]http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list \ RUN echo "deb [ arch=amd64,arm64 ]http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list \
&& apt-get remove wget -y && apt-get remove wget -y
# Install node v14 - Service Layer
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \ RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get -y install --no-install-recommends -y mongodb-org=4.4.6 nodejs \ && apt-get -y install --no-install-recommends -y mongodb-org=4.4.6 nodejs redis \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*

View File

@ -0,0 +1,17 @@
## Goal
- Build appsmith-ce image support multiple architecture (amd64 & arm64)
## Setup Build Environment
- Follow docker buildx guide to setup buildx environment [https://docs.docker.com/buildx/working-with-buildx/](https://docs.docker.com/buildx/working-with-buildx/)
- Command to setup buildx
```
docker buildx create --name builder --driver docker-container --use
docker buildx inspect --bootstrap
```
## Build
- Run command below to build & push multi-arch image to docker registry
```
docker buildx build --platform linux/arm64,linux/amd64 --push -t appsmith/appsmith-ce .
```
- To read more option of `buildx build`, read more at: [https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md)

View File

@ -0,0 +1,2 @@
#!/bin/bash
docker buildx build --platform linux/arm64,linux/amd64 --push -t appsmith/appsmith-ce .

View File

@ -33,8 +33,8 @@ init_mongodb() {
mongod --fork --port 27017 --dbpath "$MONGO_DB_PATH" --logpath "$MONGO_LOG_PATH" mongod --fork --port 27017 --dbpath "$MONGO_DB_PATH" --logpath "$MONGO_LOG_PATH"
echo "Waiting 10s for mongodb init" echo "Waiting 10s for mongodb init"
sleep 10 sleep 10
bash "/opt/appsmith/templates/mongo-init.js.sh" "$APPSMITH_MONGO_USERNAME" "$APPSMITH_MONGO_PASSWORD" >"/appsmith-stacks/configuration/mongo-init.js" bash "/opt/appsmith/templates/mongo-init.js.sh" "$MONGO_INITDB_ROOT_USERNAME" "$MONGO_INITDB_ROOT_PASSWORD" >"/appsmith-stacks/configuration/mongo-init.js"
mongo "127.0.0.1/${APPSMITH_MONGO_DATABASE}" /appsmith-stacks/configuration/mongo-init.js mongo "127.0.0.1/${MONGO_INITDB_DATABASE}" /appsmith-stacks/configuration/mongo-init.js
echo "Seeding db done" echo "Seeding db done"
echo "Enable replica set" echo "Enable replica set"
@ -136,7 +136,7 @@ configure_supervisord() {
fi fi
cp -f "$SUPERVISORD_CONF_PATH/application_process/"*.conf /etc/supervisor/conf.d cp -f "$SUPERVISORD_CONF_PATH/application_process/"*.conf /etc/supervisor/conf.d
if [[ "$APPSMITH_MONGODB_URI" = "mongodb://appsmith:$APPSMITH_MONGO_PASSWORD@localhost/appsmith" ]]; then if [[ "$APPSMITH_MONGODB_URI" = "mongodb://appsmith:$MONGO_INITDB_ROOT_PASSWORD@localhost/appsmith" ]]; then
cp "$SUPERVISORD_CONF_PATH/mongodb.conf" /etc/supervisor/conf.d/ cp "$SUPERVISORD_CONF_PATH/mongodb.conf" /etc/supervisor/conf.d/
fi fi
if [[ "$APPSMITH_REDIS_URL" = "redis://127.0.0.1:6379" ]]; then if [[ "$APPSMITH_REDIS_URL" = "redis://127.0.0.1:6379" ]]; then

View File

@ -48,6 +48,8 @@ APPSMITH_MAIL_HOST=
APPSMITH_MAIL_PORT= APPSMITH_MAIL_PORT=
APPSMITH_MAIL_USERNAME= APPSMITH_MAIL_USERNAME=
APPSMITH_MAIL_PASSWORD= APPSMITH_MAIL_PASSWORD=
APPSMITH_MAIL_FROM=
APPSMITH_REPLY_TO=
# Email server feature toggles # Email server feature toggles
# true | false values # true | false values
@ -67,9 +69,9 @@ APPSMITH_RECAPTCHA_SITE_KEY=
APPSMITH_RECAPTCHA_SECRET_KEY= APPSMITH_RECAPTCHA_SECRET_KEY=
APPSMITH_RECAPTCHA_ENABLED= APPSMITH_RECAPTCHA_ENABLED=
APPSMITH_MONGO_USERNAME=appsmith MONGO_INITDB_ROOT_USERNAME=appsmith
APPSMITH_MONGO_PASSWORD=$MONGO_PASSWORD MONGO_INITDB_ROOT_PASSWORD=$MONGO_PASSWORD
APPSMITH_MONGO_DATABASE=appsmith MONGO_INITDB_DATABASE=appsmith
APPSMITH_MONGO_HOST=localhost:27017 APPSMITH_MONGO_HOST=localhost:27017
APPSMITH_MONGODB_URI=mongodb://appsmith:$MONGO_PASSWORD@localhost/appsmith APPSMITH_MONGODB_URI=mongodb://appsmith:$MONGO_PASSWORD@localhost/appsmith
APPSMITH_API_BASE_URL=http://localhost:8080 APPSMITH_API_BASE_URL=http://localhost:8080
@ -83,4 +85,7 @@ APPSMITH_ENCRYPTION_SALT=$ENCRYPTION_SALT
APPSMITH_CUSTOM_DOMAIN= APPSMITH_CUSTOM_DOMAIN=
# APPSMITH_PLUGIN_MAX_RESPONSE_SIZE_MB=5 # APPSMITH_PLUGIN_MAX_RESPONSE_SIZE_MB=5
# MAX PAYLOAD SIZE
# APPSMITH_CODEC_SIZE=
EOF EOF