2024-05-29 11:25:41 +08:00
|
|
|
FROM node:20.13-bullseye as builder
|
2022-10-24 10:21:25 +08:00
|
|
|
ARG VERDACCIO_URL=http://host.docker.internal:10104/
|
2023-07-25 18:07:17 +08:00
|
|
|
ARG COMMIT_HASH
|
|
|
|
ARG APPEND_PRESET_LOCAL_PLUGINS
|
|
|
|
ARG BEFORE_PACK_NOCOBASE="ls -l"
|
2023-11-02 10:35:45 +08:00
|
|
|
ARG PLUGINS_DIRS
|
|
|
|
|
|
|
|
ENV PLUGINS_DIRS=${PLUGINS_DIRS}
|
2024-10-09 19:06:42 +08:00
|
|
|
ENV COMMIT_HASH=${COMMIT_HASH}
|
2024-05-22 13:28:45 +08:00
|
|
|
|
|
|
|
RUN npx npm-cli-adduser --username test --password test -e test@nocobase.com -r $VERDACCIO_URL
|
|
|
|
|
2022-10-24 00:31:24 +08:00
|
|
|
RUN apt-get update && apt-get install -y jq
|
|
|
|
WORKDIR /tmp
|
|
|
|
COPY . /tmp
|
2023-09-12 22:39:23 +08:00
|
|
|
RUN yarn install && yarn build --no-dts
|
2022-10-24 00:31:24 +08:00
|
|
|
|
2024-11-19 22:34:04 +08:00
|
|
|
SHELL ["/bin/bash", "-c"]
|
|
|
|
|
|
|
|
RUN CURRENTVERSION="$(jq -r '.version' lerna.json)" && \
|
|
|
|
IFS='.-' read -r major minor patch label <<< "$CURRENTVERSION" && \
|
|
|
|
if [ -z "$label" ]; then CURRENTVERSION="$CURRENTVERSION-rc"; fi && \
|
|
|
|
cd /tmp && \
|
|
|
|
NEWVERSION="$(echo $CURRENTVERSION).$(date +'%Y%m%d%H%M%S')" \
|
|
|
|
&& git checkout -b release-$(date +'%Y%m%d%H%M%S') \
|
|
|
|
&& yarn lerna version ${NEWVERSION} -y --no-git-tag-version
|
|
|
|
|
2023-12-18 15:21:57 +08:00
|
|
|
RUN git config user.email "test@mail.com" \
|
2022-10-24 00:31:24 +08:00
|
|
|
&& git config user.name "test" && git add . \
|
2023-12-18 15:21:57 +08:00
|
|
|
&& git commit -m "chore(versions): test publish packages"
|
|
|
|
RUN yarn release:force --registry $VERDACCIO_URL
|
2022-10-24 00:31:24 +08:00
|
|
|
|
|
|
|
RUN yarn config set registry $VERDACCIO_URL
|
|
|
|
WORKDIR /app
|
|
|
|
RUN cd /app \
|
2022-10-26 21:07:27 +08:00
|
|
|
&& yarn config set network-timeout 600000 -g \
|
2023-07-25 18:07:17 +08:00
|
|
|
&& yarn create nocobase-app my-nocobase-app -a -e APP_ENV=production -e APPEND_PRESET_LOCAL_PLUGINS=$APPEND_PRESET_LOCAL_PLUGINS \
|
2022-10-24 00:31:24 +08:00
|
|
|
&& cd /app/my-nocobase-app \
|
|
|
|
&& yarn install --production
|
|
|
|
|
2023-07-25 18:07:17 +08:00
|
|
|
WORKDIR /app/my-nocobase-app
|
|
|
|
RUN $BEFORE_PACK_NOCOBASE
|
|
|
|
|
2022-10-24 00:31:24 +08:00
|
|
|
RUN cd /app \
|
|
|
|
&& rm -rf my-nocobase-app/packages/app/client/src/.umi \
|
|
|
|
&& rm -rf nocobase.tar.gz \
|
|
|
|
&& tar -zcf ./nocobase.tar.gz -C /app/my-nocobase-app .
|
2022-08-10 12:46:01 +08:00
|
|
|
|
2024-10-09 19:06:42 +08:00
|
|
|
RUN echo "${COMMIT_HASH}" > /tmp/commit_hash.txt
|
|
|
|
|
2022-10-24 00:31:24 +08:00
|
|
|
|
2024-05-29 11:25:41 +08:00
|
|
|
FROM node:20.13-bullseye-slim
|
2024-10-09 19:06:42 +08:00
|
|
|
RUN apt-get update && apt-get install -y nginx libaio1
|
2022-08-10 12:46:01 +08:00
|
|
|
RUN rm -rf /etc/nginx/sites-enabled/default
|
2024-11-18 22:38:57 +08:00
|
|
|
|
2022-10-24 00:31:24 +08:00
|
|
|
COPY ./docker/nocobase/nocobase.conf /etc/nginx/sites-enabled/nocobase.conf
|
|
|
|
COPY --from=builder /app/nocobase.tar.gz /app/nocobase.tar.gz
|
2024-10-09 19:06:42 +08:00
|
|
|
COPY --from=builder /tmp/commit_hash.txt /app/commit_hash.txt
|
2022-08-10 12:46:01 +08:00
|
|
|
|
2022-10-24 00:31:24 +08:00
|
|
|
WORKDIR /app/nocobase
|
|
|
|
|
|
|
|
COPY ./docker/nocobase/docker-entrypoint.sh /app/
|
2022-08-10 12:46:01 +08:00
|
|
|
|
|
|
|
CMD ["/app/docker-entrypoint.sh"]
|