PromucFlow_constructor/Dockerfile

100 lines
4.2 KiB
Docker
Raw Normal View History

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.
2022-04-01 06:58:03 +00:00
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-java \
&& wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | apt-key add - \
&& echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list \
&& apt-get update && apt-get install --no-install-recommends --yes temurin-17-jdk \
&& 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
feat: Embeded PostgreSQL with mockdb data for self-hosted (#21084) ## Description This PR includes changes for self-hosted instances to utilize an embedded postgres database for the Template's mockdb. After this change, by default Appsmith will always run the embedded Postgres, and connect to it instead of the mockdb cloud instance. **Solves:** Issue[#20107](https://github.com/appsmithorg/appsmith/issues/20107) **Changes:** - [x] Install Postgresql in the Docker container using Dockerfile :- _Updated Docker file to install PostgreSQL v13_ - [x] Add provision to stop/disable Postgresql from booting based on an environment variable :- _To disable embedded postgres, set the **ENV** var `APPSMITH_ENABLE_EMBEDDED_DB` to `0`; Configured supervisord to control the lifecycle of the postgres server ( Supervisor uses user postgres to start the server since root is not allowed)_ - [x] Seed data into the Postgresql DB during first container startup. This ensures that we don't have to ship the Docker container with data & bloat it unnecessarily. :- _Curretly, the SQL dump is baked into the image._ - [x] Persist the Postgresql data in /appsmith-stacks. This ensures that the data is persisted across version upgrades. :- _The postgres uses the file system at` /stacks/data/postgres/main` ; note: The file system owner is user/group postgres_ - [x] Update the mock db endpoint in the product to use the local DB by default instead of the hosted DB for self-hosted instances. The cloud instance should still use the hosted DB :- _The embedded postgres authentication is set to the type `trust`, allowing the existing template mockdb meta data to be used without any update to the existing templates mockdb endpoint and credentials_ **Note: There is an additional table `mydb` added to the mockdb for quickly verifying the db source is the embedded postgres, since the cloud mockdb does not have that table.** --------- Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
2023-03-07 09:52:41 +00:00
# Install MongoDB v5.0.14, Redis, NodeJS - Service Layer, 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 \
&& curl --silent --show-error --location https://deb.nodesource.com/setup_18.x | bash - \
feat: Embeded PostgreSQL with mockdb data for self-hosted (#21084) ## Description This PR includes changes for self-hosted instances to utilize an embedded postgres database for the Template's mockdb. After this change, by default Appsmith will always run the embedded Postgres, and connect to it instead of the mockdb cloud instance. **Solves:** Issue[#20107](https://github.com/appsmithorg/appsmith/issues/20107) **Changes:** - [x] Install Postgresql in the Docker container using Dockerfile :- _Updated Docker file to install PostgreSQL v13_ - [x] Add provision to stop/disable Postgresql from booting based on an environment variable :- _To disable embedded postgres, set the **ENV** var `APPSMITH_ENABLE_EMBEDDED_DB` to `0`; Configured supervisord to control the lifecycle of the postgres server ( Supervisor uses user postgres to start the server since root is not allowed)_ - [x] Seed data into the Postgresql DB during first container startup. This ensures that we don't have to ship the Docker container with data & bloat it unnecessarily. :- _Curretly, the SQL dump is baked into the image._ - [x] Persist the Postgresql data in /appsmith-stacks. This ensures that the data is persisted across version upgrades. :- _The postgres uses the file system at` /stacks/data/postgres/main` ; note: The file system owner is user/group postgres_ - [x] Update the mock db endpoint in the product to use the local DB by default instead of the hosted DB for self-hosted instances. The cloud instance should still use the hosted DB :- _The embedded postgres authentication is set to the type `trust`, allowing the existing template mockdb meta data to be used without any update to the existing templates mockdb endpoint and credentials_ **Note: There is an additional table `mydb` added to the mockdb for quickly verifying the db source is the embedded postgres, since the cloud mockdb does not have that table.** --------- Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
2023-03-07 09:52:41 +00:00
&& echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-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 - \
feat: Embeded PostgreSQL with mockdb data for self-hosted (#21084) ## Description This PR includes changes for self-hosted instances to utilize an embedded postgres database for the Template's mockdb. After this change, by default Appsmith will always run the embedded Postgres, and connect to it instead of the mockdb cloud instance. **Solves:** Issue[#20107](https://github.com/appsmithorg/appsmith/issues/20107) **Changes:** - [x] Install Postgresql in the Docker container using Dockerfile :- _Updated Docker file to install PostgreSQL v13_ - [x] Add provision to stop/disable Postgresql from booting based on an environment variable :- _To disable embedded postgres, set the **ENV** var `APPSMITH_ENABLE_EMBEDDED_DB` to `0`; Configured supervisord to control the lifecycle of the postgres server ( Supervisor uses user postgres to start the server since root is not allowed)_ - [x] Seed data into the Postgresql DB during first container startup. This ensures that we don't have to ship the Docker container with data & bloat it unnecessarily. :- _Curretly, the SQL dump is baked into the image._ - [x] Persist the Postgresql data in /appsmith-stacks. This ensures that the data is persisted across version upgrades. :- _The postgres uses the file system at` /stacks/data/postgres/main` ; note: The file system owner is user/group postgres_ - [x] Update the mock db endpoint in the product to use the local DB by default instead of the hosted DB for self-hosted instances. The cloud instance should still use the hosted DB :- _The embedded postgres authentication is set to the type `trust`, allowing the existing template mockdb meta data to be used without any update to the existing templates mockdb endpoint and credentials_ **Note: There is an additional table `mydb` added to the mockdb for quickly verifying the db source is the embedded postgres, since the cloud mockdb does not have that table.** --------- Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
2023-03-07 09:52:41 +00:00
&& apt update \
&& apt-get install --no-install-recommends --yes mongodb-org nodejs redis build-essential postgresql-13 \
&& apt-get clean \
# This is to get semver 7.5.2, for a CVE fix, might be able to remove it with later versions on NodeJS.
&& npm install -g npm@9.7.2
# 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"
# Add backend server - Application Layer
ARG JAR_FILE=./app/server/dist/server-*.jar
ARG PLUGIN_JARS=./app/server/dist/plugins/*.jar
ARG APPSMITH_CLOUD_SERVICES_BASE_URL
ENV APPSMITH_CLOUD_SERVICES_BASE_URL=${APPSMITH_CLOUD_SERVICES_BASE_URL}
ARG APPSMITH_SEGMENT_CE_KEY
ENV APPSMITH_SEGMENT_CE_KEY=${APPSMITH_SEGMENT_CE_KEY}
#Create the plugins directory
RUN mkdir -p ./editor ./rts ./backend/plugins
COPY deploy/docker/fs /
#Add the jar to the container
COPY ${JAR_FILE} backend/server.jar
COPY ${PLUGIN_JARS} backend/plugins/
# Add client UI - Application Layer
COPY ./app/client/build editor/
# Add RTS - Application Layer
COPY ./app/client/packages/rts/package.json ./app/client/packages/rts/dist rts/
RUN cd ./utils && npm install --only=prod && npm install --only=prod -g . && cd - \
&& chmod 0644 /etc/cron.d/* \
&& chmod +x entrypoint.sh renew-certificate.sh healthcheck.sh templates/nginx-app.conf.sh /watchtower-hooks/*.sh \
# Disable setuid/setgid bits for the files inside container.
&& find / \( -path /proc -prune \) -o \( \( -perm -2000 -o -perm -4000 \) -print -exec chmod -s '{}' + \) || true \
&& node prepare-image.mjs
# Update path to load appsmith utils tool as default
ENV PATH /opt/appsmith/utils/node_modules/.bin:$PATH
LABEL com.centurylinklabs.watchtower.lifecycle.pre-check=/watchtower-hooks/pre-check.sh
LABEL com.centurylinklabs.watchtower.lifecycle.pre-update=/watchtower-hooks/pre-update.sh
EXPOSE 80
EXPOSE 443
ENTRYPOINT [ "/opt/appsmith/entrypoint.sh" ]
2022-05-06 06:15:56 +00:00
HEALTHCHECK --interval=15s --timeout=15s --start-period=45s CMD "/opt/appsmith/healthcheck.sh"
CMD ["/usr/bin/supervisord", "-n"]