2023-04-24 05:03:15 +00:00
|
|
|
FROM node:18 as builder
|
2022-10-24 02:21:25 +00:00
|
|
|
ARG VERDACCIO_URL=http://host.docker.internal:10104/
|
2022-11-16 04:53:58 +00:00
|
|
|
ARG COMIT_HASH
|
2022-08-10 04:46:01 +00:00
|
|
|
|
2022-10-23 16:31:24 +00:00
|
|
|
RUN apt-get update && apt-get install -y jq
|
|
|
|
WORKDIR /tmp
|
|
|
|
COPY . /tmp
|
|
|
|
RUN npx npm-cli-adduser --username test --password test -e test@nocobase.com -r $VERDACCIO_URL
|
|
|
|
RUN cd /tmp && \
|
2022-12-05 15:21:17 +00:00
|
|
|
NEWVERSION="$(cat lerna.json | jq '.version' | tr -d '"').$(date +'%Y%m%d%H%M%S')" \
|
2022-10-23 16:31:24 +00:00
|
|
|
&& tmp=$(mktemp) \
|
|
|
|
&& jq ".version = \"${NEWVERSION}\"" lerna.json > "$tmp" && mv "$tmp" lerna.json
|
|
|
|
RUN yarn install && yarn build
|
|
|
|
|
|
|
|
RUN git checkout -b release \
|
|
|
|
&& yarn version:alpha -y \
|
|
|
|
&& git config user.email "test@mail.com" \
|
|
|
|
&& git config user.name "test" && git add . \
|
|
|
|
&& git commit -m "chore(versions): test publish packages xxx" \
|
|
|
|
&& yarn release:force --registry $VERDACCIO_URL
|
|
|
|
|
|
|
|
RUN yarn config set registry $VERDACCIO_URL
|
|
|
|
WORKDIR /app
|
|
|
|
RUN cd /app \
|
2022-10-26 13:07:27 +00:00
|
|
|
&& yarn config set network-timeout 600000 -g \
|
2022-10-23 16:31:24 +00:00
|
|
|
&& yarn create nocobase-app my-nocobase-app -a -e APP_ENV=production \
|
|
|
|
&& cd /app/my-nocobase-app \
|
|
|
|
&& yarn install --production
|
|
|
|
|
|
|
|
RUN cd /app \
|
|
|
|
&& rm -rf my-nocobase-app/packages/app/client/src/.umi \
|
|
|
|
&& rm -rf nocobase.tar.gz \
|
2023-01-12 02:12:37 +00:00
|
|
|
&& rm -rf ./my-nocobase-app/node_modules/@antv \
|
2023-01-13 02:55:04 +00:00
|
|
|
&& rm -rf ./my-nocobase-app/node_modules/antd/dist \
|
|
|
|
&& rm -rf ./my-nocobase-app/node_modules/antd/es \
|
|
|
|
&& rm -rf ./my-nocobase-app/node_modules/antd/node_modules \
|
2023-01-12 02:12:37 +00:00
|
|
|
&& rm -rf ./my-nocobase-app/node_modules/@ant-design \
|
|
|
|
&& rm -rf ./my-nocobase-app/node_modules/china-division/dist/villages.json \
|
2022-10-23 16:31:24 +00:00
|
|
|
&& find ./my-nocobase-app/node_modules/china-division/dist -name '*.csv' -delete \
|
|
|
|
&& find ./my-nocobase-app/node_modules/china-division/dist -name '*.sqlite' -delete \
|
|
|
|
&& tar -zcf ./nocobase.tar.gz -C /app/my-nocobase-app .
|
2022-08-10 04:46:01 +00:00
|
|
|
|
2022-10-23 16:31:24 +00:00
|
|
|
|
2023-04-24 06:27:11 +00:00
|
|
|
FROM node:16.20-bullseye-slim
|
2022-10-23 16:31:24 +00:00
|
|
|
RUN apt-get update && apt-get install -y nginx
|
2022-08-10 04:46:01 +00:00
|
|
|
|
|
|
|
RUN rm -rf /etc/nginx/sites-enabled/default
|
2022-10-23 16:31:24 +00:00
|
|
|
COPY ./docker/nocobase/nocobase.conf /etc/nginx/sites-enabled/nocobase.conf
|
|
|
|
COPY --from=builder /app/nocobase.tar.gz /app/nocobase.tar.gz
|
2022-08-10 04:46:01 +00:00
|
|
|
|
2022-10-23 16:31:24 +00:00
|
|
|
WORKDIR /app/nocobase
|
|
|
|
|
2022-11-16 04:53:58 +00:00
|
|
|
RUN mkdir -p /app/nocobase/storage/uploads/ && echo "$COMIT_HASH" >> /app/nocobase/storage/uploads/COMIT_HASH
|
|
|
|
|
2022-10-23 16:31:24 +00:00
|
|
|
COPY ./docker/nocobase/docker-entrypoint.sh /app/
|
2022-08-10 04:46:01 +00:00
|
|
|
|
|
|
|
CMD ["/app/docker-entrypoint.sh"]
|
2022-10-23 16:31:24 +00:00
|
|
|
|