2022-06-16 21:38:24 +02:00
|
|
|
|
FROM node:14-slim as build
|
|
|
|
|
|
|
|
|
|
# install node-gyp dependencies
|
2022-06-22 14:57:46 +02:00
|
|
|
|
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends apt-utils cron g++ make python
|
2022-06-16 21:38:24 +02:00
|
|
|
|
|
|
|
|
|
# add pin script
|
|
|
|
|
WORKDIR /
|
|
|
|
|
ADD scripts/pinVersions.js scripts/cleanup.sh ./
|
|
|
|
|
RUN chmod +x /cleanup.sh
|
|
|
|
|
|
|
|
|
|
# build server
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
ADD packages/server .
|
|
|
|
|
RUN node /pinVersions.js && yarn && yarn build && /cleanup.sh
|
|
|
|
|
|
|
|
|
|
# build worker
|
|
|
|
|
WORKDIR /worker
|
|
|
|
|
ADD packages/worker .
|
|
|
|
|
RUN node /pinVersions.js && yarn && yarn build && /cleanup.sh
|
|
|
|
|
|
2022-06-16 20:30:34 +02:00
|
|
|
|
FROM couchdb:3.2.1
|
2022-06-24 18:48:34 +02:00
|
|
|
|
# TARGETARCH can be amd64 or arm e.g. docker build --build-arg TARGETARCH=amd64
|
2022-06-22 13:40:33 +02:00
|
|
|
|
ARG TARGETARCH amd64
|
2022-06-24 18:48:34 +02:00
|
|
|
|
#TARGETBUILD can be set to single (for single docker image) or aas (for azure app service)
|
|
|
|
|
# e.g. docker build --build-arg TARGETBUILD=aas ....
|
|
|
|
|
ARG TARGETBUILD single
|
|
|
|
|
ENV TARGETBUILD $TARGETBUILD
|
2022-06-21 18:56:55 +02:00
|
|
|
|
|
2022-06-16 21:38:24 +02:00
|
|
|
|
COPY --from=build /app /app
|
|
|
|
|
COPY --from=build /worker /worker
|
|
|
|
|
|
2022-06-22 14:38:33 +02:00
|
|
|
|
ENV \
|
|
|
|
|
APP_PORT=4001 \
|
|
|
|
|
ARCHITECTURE=amd \
|
|
|
|
|
BUDIBASE_ENVIRONMENT=PRODUCTION \
|
|
|
|
|
CLUSTER_PORT=80 \
|
2022-06-23 16:03:09 +02:00
|
|
|
|
# CUSTOM_DOMAIN=budi001.custom.com \
|
2022-06-22 14:38:33 +02:00
|
|
|
|
DEPLOYMENT_ENVIRONMENT=docker \
|
|
|
|
|
MINIO_URL=http://localhost:9000 \
|
2022-08-08 15:03:04 +02:00
|
|
|
|
POSTHOG_TOKEN=phc_bIjZL7oh2GEUd2vqvTBH8WvrX0fWTFQMs6H5KQxiUxU \
|
2022-06-22 14:38:33 +02:00
|
|
|
|
REDIS_URL=localhost:6379 \
|
|
|
|
|
SELF_HOSTED=1 \
|
2022-06-24 18:48:34 +02:00
|
|
|
|
TARGETBUILD=$TARGETBUILD \
|
2022-06-22 14:38:33 +02:00
|
|
|
|
WORKER_PORT=4002 \
|
2022-07-06 17:33:40 +02:00
|
|
|
|
WORKER_URL=http://localhost:4002 \
|
|
|
|
|
APPS_URL=http://localhost:4001
|
2022-04-01 02:00:52 +02:00
|
|
|
|
|
2022-07-08 19:33:07 +02:00
|
|
|
|
# These secret env variables are generated by the runner at startup
|
|
|
|
|
# their values can be overriden by the user, they will be written
|
|
|
|
|
# to the .env file in the /data directory for use later on
|
|
|
|
|
# REDIS_PASSWORD=budibase \
|
|
|
|
|
# COUCHDB_PASSWORD=budibase \
|
|
|
|
|
# COUCHDB_USER=budibase \
|
|
|
|
|
# COUCH_DB_URL=http://budibase:budibase@localhost:5984 \
|
|
|
|
|
# INTERNAL_API_KEY=budibase \
|
|
|
|
|
# JWT_SECRET=testsecret \
|
|
|
|
|
# MINIO_ACCESS_KEY=budibase \
|
|
|
|
|
# MINIO_SECRET_KEY=budibase \
|
|
|
|
|
|
2022-06-16 20:30:34 +02:00
|
|
|
|
# install base dependencies
|
|
|
|
|
RUN apt-get update && \
|
2022-07-08 19:33:07 +02:00
|
|
|
|
apt-get install -y software-properties-common wget nginx uuid-runtime && \
|
2022-06-16 20:30:34 +02:00
|
|
|
|
apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main' && \
|
|
|
|
|
apt-get update
|
|
|
|
|
|
|
|
|
|
# install other dependencies, nodejs, oracle requirements, jdk8, redis, nginx
|
|
|
|
|
WORKDIR /nodejs
|
|
|
|
|
RUN curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh && \
|
|
|
|
|
bash /tmp/nodesource_setup.sh && \
|
2022-06-22 14:38:33 +02:00
|
|
|
|
apt-get install -y libaio1 nodejs nginx openjdk-8-jdk redis-server unzip && \
|
2022-06-16 20:30:34 +02:00
|
|
|
|
npm install --global yarn pm2
|
2022-04-01 02:00:52 +02:00
|
|
|
|
|
2022-04-05 12:33:55 +02:00
|
|
|
|
# setup nginx
|
2022-07-08 15:28:09 +02:00
|
|
|
|
ADD hosting/single/nginx/nginx.conf /etc/nginx
|
|
|
|
|
ADD hosting/single/nginx/nginx-default-site.conf /etc/nginx/sites-enabled/default
|
2022-06-22 14:38:33 +02:00
|
|
|
|
RUN mkdir -p /var/log/nginx && \
|
|
|
|
|
touch /var/log/nginx/error.log && \
|
|
|
|
|
touch /var/run/nginx.pid
|
2022-04-01 02:00:52 +02:00
|
|
|
|
|
2022-06-16 20:30:34 +02:00
|
|
|
|
WORKDIR /
|
2022-06-16 21:38:24 +02:00
|
|
|
|
RUN mkdir -p scripts/integrations/oracle
|
|
|
|
|
ADD packages/server/scripts/integrations/oracle scripts/integrations/oracle
|
2022-06-21 18:56:55 +02:00
|
|
|
|
RUN /bin/bash -e ./scripts/integrations/oracle/instantclient/linux/install.sh
|
2022-04-01 02:00:52 +02:00
|
|
|
|
|
|
|
|
|
# setup clouseau
|
|
|
|
|
WORKDIR /
|
2022-06-16 20:30:34 +02:00
|
|
|
|
RUN wget https://github.com/cloudant-labs/clouseau/releases/download/2.21.0/clouseau-2.21.0-dist.zip && \
|
|
|
|
|
unzip clouseau-2.21.0-dist.zip && \
|
|
|
|
|
mv clouseau-2.21.0 /opt/clouseau && \
|
|
|
|
|
rm clouseau-2.21.0-dist.zip
|
2022-04-01 02:00:52 +02:00
|
|
|
|
|
|
|
|
|
WORKDIR /opt/clouseau
|
|
|
|
|
RUN mkdir ./bin
|
2022-07-08 15:28:09 +02:00
|
|
|
|
ADD hosting/single/clouseau/clouseau ./bin/
|
|
|
|
|
ADD hosting/single/clouseau/log4j.properties hosting/single/clouseau/clouseau.ini ./
|
2022-04-01 02:00:52 +02:00
|
|
|
|
RUN chmod +x ./bin/clouseau
|
|
|
|
|
|
|
|
|
|
# setup CouchDB
|
|
|
|
|
WORKDIR /opt/couchdb
|
2022-07-08 15:28:09 +02:00
|
|
|
|
ADD hosting/single/couch/vm.args hosting/single/couch/local.ini ./etc/
|
2022-04-01 02:00:52 +02:00
|
|
|
|
|
|
|
|
|
# setup minio
|
|
|
|
|
WORKDIR /minio
|
2022-06-22 13:40:33 +02:00
|
|
|
|
ADD scripts/install-minio.sh ./install.sh
|
|
|
|
|
RUN chmod +x install.sh && ./install.sh
|
2022-04-01 02:00:52 +02:00
|
|
|
|
|
2022-04-05 12:33:55 +02:00
|
|
|
|
# setup runner file
|
2022-04-01 02:00:52 +02:00
|
|
|
|
WORKDIR /
|
|
|
|
|
ADD hosting/single/runner.sh .
|
|
|
|
|
RUN chmod +x ./runner.sh
|
2022-07-19 15:39:52 +02:00
|
|
|
|
ADD hosting/single/healthcheck.sh .
|
2022-06-22 14:38:33 +02:00
|
|
|
|
RUN chmod +x ./healthcheck.sh
|
2022-04-01 02:00:52 +02:00
|
|
|
|
|
2022-06-24 18:48:34 +02:00
|
|
|
|
ADD hosting/scripts/build-target-paths.sh .
|
|
|
|
|
RUN chmod +x ./build-target-paths.sh
|
|
|
|
|
|
|
|
|
|
# For Azure App Service install SSH & point data locations to /home
|
|
|
|
|
RUN /build-target-paths.sh
|
|
|
|
|
|
2022-06-16 21:38:24 +02:00
|
|
|
|
# cleanup cache
|
|
|
|
|
RUN yarn cache clean -f
|
|
|
|
|
|
2022-06-22 14:38:33 +02:00
|
|
|
|
EXPOSE 80
|
|
|
|
|
EXPOSE 443
|
2022-07-15 12:08:03 +02:00
|
|
|
|
VOLUME /data
|
2022-04-01 02:00:52 +02:00
|
|
|
|
|
2022-06-22 14:38:33 +02:00
|
|
|
|
# setup letsencrypt certificate
|
|
|
|
|
RUN apt-get install -y certbot python3-certbot-nginx
|
|
|
|
|
ADD hosting/letsencrypt /app/letsencrypt
|
|
|
|
|
RUN chmod +x /app/letsencrypt/certificate-request.sh /app/letsencrypt/certificate-renew.sh
|
|
|
|
|
# Remove cached files
|
|
|
|
|
RUN rm -rf \
|
|
|
|
|
/root/.cache \
|
|
|
|
|
/root/.npm \
|
|
|
|
|
/root/.pip \
|
|
|
|
|
/usr/local/share/doc \
|
|
|
|
|
/usr/share/doc \
|
|
|
|
|
/usr/share/man \
|
|
|
|
|
/var/lib/apt/lists/* \
|
|
|
|
|
/tmp/*
|
|
|
|
|
|
|
|
|
|
HEALTHCHECK --interval=15s --timeout=15s --start-period=45s CMD "/healthcheck.sh"
|
|
|
|
|
|
2022-04-01 02:00:52 +02:00
|
|
|
|
# must set this just before running
|
|
|
|
|
ENV NODE_ENV=production
|
2022-06-16 21:38:24 +02:00
|
|
|
|
WORKDIR /
|
|
|
|
|
|
2022-04-01 02:00:52 +02:00
|
|
|
|
CMD ["./runner.sh"]
|