feat: support custom plugin deployment in dockerfile (#1494)

This commit is contained in:
ChengLei Shao 2023-02-24 15:42:23 +08:00 committed by GitHub
parent e08a8735b1
commit 1bf0e0ac72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,8 @@
FROM node:16 as builder FROM node:16 as builder
ARG VERDACCIO_URL=http://host.docker.internal:10104/ ARG VERDACCIO_URL=http://host.docker.internal:10104/
ARG COMIT_HASH ARG COMMIT_HASH
ARG APPEND_PRESET_LOCAL_PLUGINS
ARG BEFORE_PACK_NOCOBASE="ls -l"
RUN apt-get update && apt-get install -y jq RUN apt-get update && apt-get install -y jq
WORKDIR /tmp WORKDIR /tmp
@ -23,10 +25,13 @@ RUN yarn config set registry $VERDACCIO_URL
WORKDIR /app WORKDIR /app
RUN cd /app \ RUN cd /app \
&& yarn config set network-timeout 600000 -g \ && yarn config set network-timeout 600000 -g \
&& yarn create nocobase-app my-nocobase-app -a -e APP_ENV=production \ && yarn create nocobase-app my-nocobase-app -a -e APP_ENV=production -e APPEND_PRESET_LOCAL_PLUGINS=$APPEND_PRESET_LOCAL_PLUGINS \
&& cd /app/my-nocobase-app \ && cd /app/my-nocobase-app \
&& yarn install --production && yarn install --production
WORKDIR /app/my-nocobase-app
RUN $BEFORE_PACK_NOCOBASE
RUN cd /app \ RUN cd /app \
&& rm -rf my-nocobase-app/packages/app/client/src/.umi \ && rm -rf my-nocobase-app/packages/app/client/src/.umi \
&& rm -rf nocobase.tar.gz \ && rm -rf nocobase.tar.gz \
@ -50,7 +55,7 @@ COPY --from=builder /app/nocobase.tar.gz /app/nocobase.tar.gz
WORKDIR /app/nocobase WORKDIR /app/nocobase
RUN mkdir -p /app/nocobase/storage/uploads/ && echo "$COMIT_HASH" >> /app/nocobase/storage/uploads/COMIT_HASH 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/