Unify dependencies
This commit is contained in:
parent
7befdad068
commit
f23e91c6ce
|
@ -3,24 +3,26 @@ FROM node:18-slim as build
|
|||
# install node-gyp dependencies
|
||||
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends apt-utils cron g++ make python3
|
||||
|
||||
# add pin script
|
||||
WORKDIR /
|
||||
ADD scripts/cleanup.sh ./
|
||||
RUN chmod +x /cleanup.sh
|
||||
|
||||
# build server
|
||||
# copy and install dependencies
|
||||
WORKDIR /app
|
||||
ADD packages/server .
|
||||
COPY package.json .
|
||||
COPY yarn.lock .
|
||||
RUN yarn install --production=true
|
||||
RUN /cleanup.sh
|
||||
COPY lerna.json .
|
||||
COPY .yarnrc .
|
||||
|
||||
COPY packages/server/package.json packages/server/
|
||||
COPY packages/worker/package.json packages/worker/
|
||||
|
||||
# We will never want to sync pro, but the script is still required
|
||||
RUN mkdir scripts && echo '' > scripts/syncProPackage.js
|
||||
RUN yarn install --frozen-lockfile && yarn cache clean
|
||||
|
||||
# copy the actual code
|
||||
COPY packages/server/dist packages/server/dist
|
||||
COPY packages/server/client packages/server/client
|
||||
COPY packages/worker/dist packages/server/dist
|
||||
|
||||
# build worker
|
||||
WORKDIR /worker
|
||||
ADD packages/worker .
|
||||
COPY yarn.lock .
|
||||
RUN yarn install --production=true
|
||||
RUN /cleanup.sh
|
||||
|
||||
FROM budibase/couchdb
|
||||
ARG TARGETARCH
|
||||
|
@ -30,9 +32,6 @@ ENV TARGETARCH $TARGETARCH
|
|||
ARG TARGETBUILD=single
|
||||
ENV TARGETBUILD $TARGETBUILD
|
||||
|
||||
COPY --from=build /app /app
|
||||
COPY --from=build /worker /worker
|
||||
|
||||
# install base dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends software-properties-common nginx uuid-runtime redis-server
|
||||
|
@ -53,8 +52,8 @@ RUN curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh &
|
|||
npm install --global yarn pm2
|
||||
|
||||
# setup nginx
|
||||
ADD hosting/single/nginx/nginx.conf /etc/nginx
|
||||
ADD hosting/single/nginx/nginx-default-site.conf /etc/nginx/sites-enabled/default
|
||||
COPY hosting/single/nginx/nginx.conf /etc/nginx
|
||||
COPY hosting/single/nginx/nginx-default-site.conf /etc/nginx/sites-enabled/default
|
||||
RUN mkdir -p /var/log/nginx && \
|
||||
touch /var/log/nginx/error.log && \
|
||||
touch /var/run/nginx.pid && \
|
||||
|
@ -62,29 +61,29 @@ RUN mkdir -p /var/log/nginx && \
|
|||
|
||||
WORKDIR /
|
||||
RUN mkdir -p scripts/integrations/oracle
|
||||
ADD packages/server/scripts/integrations/oracle scripts/integrations/oracle
|
||||
COPY packages/server/scripts/integrations/oracle scripts/integrations/oracle
|
||||
RUN /bin/bash -e ./scripts/integrations/oracle/instantclient/linux/install.sh
|
||||
|
||||
# setup minio
|
||||
WORKDIR /minio
|
||||
ADD scripts/install-minio.sh ./install.sh
|
||||
COPY scripts/install-minio.sh ./install.sh
|
||||
RUN chmod +x install.sh && ./install.sh
|
||||
|
||||
# setup runner file
|
||||
WORKDIR /
|
||||
ADD hosting/single/runner.sh .
|
||||
COPY hosting/single/runner.sh .
|
||||
RUN chmod +x ./runner.sh
|
||||
ADD hosting/single/healthcheck.sh .
|
||||
COPY hosting/single/healthcheck.sh .
|
||||
RUN chmod +x ./healthcheck.sh
|
||||
|
||||
# Script below sets the path for storing data based on $DATA_DIR
|
||||
# For Azure App Service install SSH & point data locations to /home
|
||||
ADD hosting/single/ssh/sshd_config /etc/
|
||||
ADD hosting/single/ssh/ssh_setup.sh /tmp
|
||||
COPY hosting/single/ssh/sshd_config /etc/
|
||||
COPY hosting/single/ssh/ssh_setup.sh /tmp
|
||||
RUN /build-target-paths.sh
|
||||
|
||||
# cleanup cache
|
||||
RUN yarn cache clean -f
|
||||
COPY --from=build /app /app
|
||||
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
@ -94,7 +93,7 @@ VOLUME /data
|
|||
|
||||
# setup letsencrypt certificate
|
||||
RUN apt-get install -y certbot python3-certbot-nginx
|
||||
ADD hosting/letsencrypt /app/letsencrypt
|
||||
COPY hosting/letsencrypt /app/letsencrypt
|
||||
RUN chmod +x /app/letsencrypt/certificate-request.sh /app/letsencrypt/certificate-renew.sh
|
||||
# Remove cached files
|
||||
RUN rm -rf \
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/bin/bash
|
||||
source ${BASH_SOURCE%/*}/updateVersions.sh
|
||||
yarn build --scope @budibase/server --scope @budibase/worker
|
||||
source ${BASH_SOURCE%/*}/removeWorkspaceDependencies.sh
|
||||
docker build -f hosting/single/Dockerfile -t budibase:latest .
|
||||
source ${BASH_SOURCE%/*}/resetVersions.sh
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
package_json=$(cat "$1")
|
||||
|
||||
root_package_json=$(cat "package.json")
|
||||
|
||||
|
||||
for workspace_package in $(echo "$root_package_json" | jq -r '.workspaces.packages[]' ); do
|
||||
package_name=$(cat "$workspace_package/package.json" | jq -r '.name')
|
||||
has_changes=false
|
||||
|
||||
if echo "$package_json" | jq -e --arg package_name "$package_name" '.dependencies | has($package_name)' > /dev/null; then
|
||||
|
||||
package_json=$(echo "$package_json" | jq "del(.dependencies[\"$package_name\"])")
|
||||
has_changes=true
|
||||
fi
|
||||
|
||||
if [ "$has_changes" = true ]; then
|
||||
echo "$package_json" > "$1"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$root_package_json" | jq "del(.resolutions)" > "package.json"
|
Loading…
Reference in New Issue