2024-04-15 23:04:43 +08:00
|
|
|
FROM node:20-bullseye-slim as base
|
|
|
|
RUN apt-get update && apt-get install -y nginx
|
|
|
|
RUN rm -rf /etc/nginx/sites-enabled/default
|
2024-05-24 13:06:59 +08:00
|
|
|
COPY ./docker/tachybase/tachybase.conf /etc/nginx/sites-enabled/tachybase.conf
|
2024-04-15 23:04:43 +08:00
|
|
|
|
|
|
|
FROM node:20-bullseye as build-template-app
|
|
|
|
ARG NPM_REGISTRY=https://registry.npmjs.org/
|
2024-04-19 23:02:27 +08:00
|
|
|
ARG TACHYBASE_VERSION=0.21.16
|
2024-04-01 17:29:46 +08:00
|
|
|
|
|
|
|
ENV PNPM_HOME="/pnpm"
|
|
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
|
|
RUN corepack enable
|
|
|
|
|
2022-10-24 00:31:24 +08:00
|
|
|
WORKDIR /app
|
2024-05-24 13:06:59 +08:00
|
|
|
RUN cd /app && npx --registry $NPM_REGISTRY create-tachybase-app@$TACHYBASE_VERSION my-tachybase-app -a -e APP_ENV=production
|
2024-04-15 23:04:43 +08:00
|
|
|
RUN pnpm config set registry $NPM_REGISTRY
|
2024-05-24 13:06:59 +08:00
|
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store cd /app/my-tachybase-app && pnpm install --production
|
2022-10-24 00:31:24 +08:00
|
|
|
|
2024-05-24 13:06:59 +08:00
|
|
|
WORKDIR /app/my-tachybase-app
|
2023-07-25 18:07:17 +08:00
|
|
|
|
2022-10-24 00:31:24 +08:00
|
|
|
RUN cd /app \
|
2024-05-24 13:06:59 +08:00
|
|
|
&& rm -rf my-tachybase-app/packages/app/client/src/.umi \
|
|
|
|
&& rm -rf tachybase.tar.gz \
|
|
|
|
&& tar -zcf ./tachybase.tar.gz -C /app/my-tachybase-app .
|
2022-08-10 12:46:01 +08:00
|
|
|
|
2024-04-15 23:04:43 +08:00
|
|
|
FROM base AS build-app
|
2024-05-24 13:06:59 +08:00
|
|
|
COPY --from=build-template-app /app/tachybase.tar.gz /app/tachybase.tar.gz
|
2022-08-10 12:46:01 +08:00
|
|
|
|
2024-05-24 13:06:59 +08:00
|
|
|
WORKDIR /app/tachybase
|
2022-10-24 00:31:24 +08:00
|
|
|
|
2024-05-24 13:06:59 +08:00
|
|
|
RUN mkdir -p /app/tachybase/storage/uploads/ && echo "$COMMIT_HASH" >> /app/tachybase/storage/uploads/COMMIT_HASH
|
2022-11-16 12:53:58 +08:00
|
|
|
|
2024-05-24 13:06:59 +08:00
|
|
|
COPY ./docker/tachybase/docker-entrypoint.sh /app/
|
2022-08-10 12:46:01 +08:00
|
|
|
|
2024-04-01 17:29:46 +08:00
|
|
|
ENV PNPM_HOME="/pnpm"
|
|
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
|
|
RUN corepack enable
|
2024-04-15 23:04:43 +08:00
|
|
|
RUN pnpm config set registry $NPM_REGISTRY
|
2024-04-01 17:29:46 +08:00
|
|
|
|
2022-08-10 12:46:01 +08:00
|
|
|
CMD ["/app/docker-entrypoint.sh"]
|