chore: start up scripts in docker (#5361)
Some checks failed
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
NocoBase Backend Test / sqlite-test (20, false) (push) Has been cancelled
NocoBase Backend Test / sqlite-test (20, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, nocobase, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, nocobase, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, public, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, public, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, public, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, public, true) (push) Has been cancelled
NocoBase Backend Test / mysql-test (20, false) (push) Has been cancelled
NocoBase Backend Test / mysql-test (20, true) (push) Has been cancelled
NocoBase Backend Test / mariadb-test (20, false) (push) Has been cancelled
NocoBase Backend Test / mariadb-test (20, true) (push) Has been cancelled
Test on Windows / build (push) Has been cancelled

* chore: start up scripts

* fix: build image

* fix: commit hash

* chore: dockerfile

* chore: dockerfile

* chore: dockerfile
This commit is contained in:
ChengLei Shao 2024-10-09 19:06:42 +08:00 committed by GitHub
parent f58013ee06
commit 8b9acde16a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 6 deletions

View File

@ -92,7 +92,7 @@ jobs:
file: Dockerfile file: Dockerfile
build-args: | build-args: |
VERDACCIO_URL=http://localhost:4873/ VERDACCIO_URL=http://localhost:4873/
COMMIT_HASH=${GITHUB_SHA} COMMIT_HASH=${{ github.sha }}
push: true push: true
tags: ${{ steps.set-tags.outputs.tags }} tags: ${{ steps.set-tags.outputs.tags }}

View File

@ -6,7 +6,7 @@ ARG BEFORE_PACK_NOCOBASE="ls -l"
ARG PLUGINS_DIRS ARG PLUGINS_DIRS
ENV PLUGINS_DIRS=${PLUGINS_DIRS} ENV PLUGINS_DIRS=${PLUGINS_DIRS}
ENV COMMIT_HASH=${COMMIT_HASH}
RUN npx npm-cli-adduser --username test --password test -e test@nocobase.com -r $VERDACCIO_URL RUN npx npm-cli-adduser --username test --password test -e test@nocobase.com -r $VERDACCIO_URL
@ -40,17 +40,18 @@ RUN cd /app \
&& rm -rf nocobase.tar.gz \ && rm -rf nocobase.tar.gz \
&& tar -zcf ./nocobase.tar.gz -C /app/my-nocobase-app . && tar -zcf ./nocobase.tar.gz -C /app/my-nocobase-app .
RUN echo "${COMMIT_HASH}" > /tmp/commit_hash.txt
FROM node:20.13-bullseye-slim FROM node:20.13-bullseye-slim
RUN apt-get update && apt-get install -y nginx RUN apt-get update && apt-get install -y nginx libaio1
RUN rm -rf /etc/nginx/sites-enabled/default RUN rm -rf /etc/nginx/sites-enabled/default
COPY ./docker/nocobase/nocobase.conf /etc/nginx/sites-enabled/nocobase.conf COPY ./docker/nocobase/nocobase.conf /etc/nginx/sites-enabled/nocobase.conf
COPY --from=builder /app/nocobase.tar.gz /app/nocobase.tar.gz COPY --from=builder /app/nocobase.tar.gz /app/nocobase.tar.gz
COPY --from=builder /tmp/commit_hash.txt /app/commit_hash.txt
WORKDIR /app/nocobase WORKDIR /app/nocobase
RUN mkdir -p /app/nocobase/storage/uploads/ && echo "$COMMIT_HASH" >> /app/nocobase/storage/uploads/COMMIT_HASH
COPY ./docker/nocobase/docker-entrypoint.sh /app/ COPY ./docker/nocobase/docker-entrypoint.sh /app/
CMD ["/app/docker-entrypoint.sh"] CMD ["/app/docker-entrypoint.sh"]

View File

@ -1,6 +1,8 @@
#!/bin/sh #!/bin/sh
set -e set -e
echo "COMMIT_HASH: $(cat /app/commit_hash.txt)"
if [ ! -d "/app/nocobase" ]; then if [ ! -d "/app/nocobase" ]; then
mkdir nocobase mkdir nocobase
fi fi
@ -18,6 +20,14 @@ ln -s /app/nocobase/storage/nocobase.conf /etc/nginx/sites-enabled/nocobase.conf
nginx nginx
echo 'nginx started'; echo 'nginx started';
# run scripts in storage/scripts
if [ -d "/app/nocobase/storage/scripts" ]; then
for f in /app/nocobase/storage/scripts/*.sh; do
echo "Running $f"
sh "$f"
done
fi
cd /app/nocobase && yarn start --quickstart cd /app/nocobase && yarn start --quickstart
# Run command with node if the first argument contains a "-" or is not a system command. The last # Run command with node if the first argument contains a "-" or is not a system command. The last

4
storage/.gitignore vendored
View File

@ -4,4 +4,6 @@ app.watch.ts
/e2e /e2e
nocobase.conf nocobase.conf
app-upgrading app-upgrading
/verdaccio/storage /verdaccio/storage
libs
scripts