2023-11-29 10:34:51 +03:00
|
|
|
ARG NODE_VERSION="20.10"
|
2023-06-10 12:15:35 +03:00
|
|
|
ARG ALPINE_VERSION="3.18"
|
2022-09-06 14:51:38 +03:00
|
|
|
|
2023-03-28 22:27:29 +03:00
|
|
|
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS node_base
|
2023-03-02 22:19:20 +03:00
|
|
|
|
2024-03-03 21:05:09 +03:00
|
|
|
# ---- BUILDER BASE ----
|
2023-03-02 22:19:20 +03:00
|
|
|
FROM node_base AS builder_base
|
2022-12-15 17:18:25 +03:00
|
|
|
|
2024-03-18 00:23:34 +03:00
|
|
|
ARG SENTRY_AUTH_TOKEN
|
|
|
|
ARG TIPI_VERSION
|
2024-03-21 19:57:15 +03:00
|
|
|
ARG LOCAL
|
2024-03-18 00:23:34 +03:00
|
|
|
|
|
|
|
ENV SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}
|
|
|
|
ENV TIPI_VERSION=${TIPI_VERSION}
|
2024-03-21 19:57:15 +03:00
|
|
|
ENV LOCAL=${LOCAL}
|
2024-03-18 00:23:34 +03:00
|
|
|
|
2023-03-02 22:19:20 +03:00
|
|
|
RUN npm install pnpm -g
|
2024-03-18 00:23:34 +03:00
|
|
|
RUN apk add --no-cache curl python3 make g++ git
|
2022-09-06 14:51:38 +03:00
|
|
|
|
2024-03-03 21:05:09 +03:00
|
|
|
# ---- RUNNER BASE ----
|
|
|
|
FROM node_base AS runner_base
|
2023-03-02 22:19:20 +03:00
|
|
|
|
2024-03-03 21:05:09 +03:00
|
|
|
RUN apk add --no-cache curl openssl git
|
|
|
|
RUN npm install pm2 -g
|
|
|
|
|
|
|
|
# ---- BUILD DASHBOARD ----
|
|
|
|
FROM builder_base AS dashboard_builder
|
|
|
|
|
|
|
|
WORKDIR /dashboard
|
2023-03-02 22:19:20 +03:00
|
|
|
|
|
|
|
COPY ./pnpm-lock.yaml ./
|
2023-12-19 22:49:39 +03:00
|
|
|
RUN pnpm fetch
|
2023-03-02 22:19:20 +03:00
|
|
|
|
2023-12-19 22:49:39 +03:00
|
|
|
COPY ./pnpm-workspace.yaml ./
|
2023-03-02 22:19:20 +03:00
|
|
|
COPY ./package*.json ./
|
2023-08-28 21:39:02 +03:00
|
|
|
COPY ./packages/shared ./packages/shared
|
2023-03-02 22:19:20 +03:00
|
|
|
|
|
|
|
RUN pnpm install -r --prefer-offline
|
|
|
|
COPY ./src ./src
|
|
|
|
COPY ./tsconfig.json ./tsconfig.json
|
|
|
|
COPY ./next.config.mjs ./next.config.mjs
|
|
|
|
COPY ./public ./public
|
2023-06-28 23:44:56 +03:00
|
|
|
COPY ./tests ./tests
|
2022-09-06 14:51:38 +03:00
|
|
|
|
2023-12-08 17:48:49 +03:00
|
|
|
# Sentry
|
|
|
|
COPY ./sentry.client.config.ts ./sentry.client.config.ts
|
|
|
|
COPY ./sentry.edge.config.ts ./sentry.edge.config.ts
|
|
|
|
COPY ./sentry.server.config.ts ./sentry.server.config.ts
|
|
|
|
|
2023-12-19 22:49:39 +03:00
|
|
|
RUN pnpm build
|
2022-09-06 14:51:38 +03:00
|
|
|
|
2024-03-03 21:05:09 +03:00
|
|
|
# ---- BUILD WORKER ----
|
|
|
|
FROM builder_base AS worker_builder
|
|
|
|
|
|
|
|
WORKDIR /worker
|
|
|
|
|
|
|
|
ARG TARGETARCH
|
|
|
|
ENV TARGETARCH=${TARGETARCH}
|
|
|
|
ARG DOCKER_COMPOSE_VERSION="v2.23.3"
|
|
|
|
|
|
|
|
RUN echo "Building for ${TARGETARCH}"
|
|
|
|
|
|
|
|
|
|
|
|
RUN if [ "${TARGETARCH}" = "arm64" ]; then \
|
|
|
|
curl -L -o docker-binary "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-linux-aarch64"; \
|
|
|
|
elif [ "${TARGETARCH}" = "amd64" ]; then \
|
|
|
|
curl -L -o docker-binary "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-linux-x86_64"; \
|
|
|
|
else \
|
|
|
|
echo "Unsupported architecture"; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
RUN chmod +x docker-binary
|
|
|
|
|
|
|
|
COPY ./pnpm-lock.yaml ./
|
|
|
|
RUN pnpm fetch --ignore-scripts
|
|
|
|
|
|
|
|
COPY ./pnpm-workspace.yaml ./
|
2024-03-21 09:41:20 +03:00
|
|
|
COPY ./packages/worker/package.json ./packages/worker/package.json
|
|
|
|
COPY ./packages/shared/package.json ./packages/shared/package.json
|
2024-03-03 21:05:09 +03:00
|
|
|
|
|
|
|
RUN pnpm install -r --prefer-offline
|
|
|
|
|
2024-03-21 09:41:20 +03:00
|
|
|
COPY ./packages ./packages
|
2024-03-03 21:05:09 +03:00
|
|
|
COPY ./packages/worker/build.js ./packages/worker/build.js
|
|
|
|
COPY ./packages/worker/src ./packages/worker/src
|
|
|
|
COPY ./packages/worker/package.json ./packages/worker/package.json
|
|
|
|
COPY ./packages/worker/assets ./packages/worker/assets
|
|
|
|
|
2024-03-18 00:23:34 +03:00
|
|
|
# Print TIPI_VERSION to the console
|
|
|
|
RUN echo "TIPI_VERSION: ${TIPI_VERSION}"
|
2024-03-03 21:05:09 +03:00
|
|
|
|
2024-03-18 00:23:34 +03:00
|
|
|
RUN pnpm -r --filter @runtipi/worker build
|
2024-03-03 21:05:09 +03:00
|
|
|
|
|
|
|
# ---- RUNNER ----
|
|
|
|
FROM runner_base AS app
|
|
|
|
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
|
|
|
|
WORKDIR /worker
|
2023-03-02 22:19:20 +03:00
|
|
|
|
2024-03-03 21:05:09 +03:00
|
|
|
COPY --from=worker_builder /worker/packages/worker/dist .
|
|
|
|
COPY --from=worker_builder /worker/packages/worker/assets ./assets
|
|
|
|
COPY --from=worker_builder /worker/docker-binary /usr/local/bin/docker-compose
|
2023-11-25 13:24:08 +03:00
|
|
|
|
2024-03-03 21:05:09 +03:00
|
|
|
WORKDIR /dashboard
|
2022-06-03 23:42:23 +03:00
|
|
|
|
2024-03-03 21:05:09 +03:00
|
|
|
COPY --from=dashboard_builder /dashboard/next.config.mjs ./
|
|
|
|
COPY --from=dashboard_builder /dashboard/public ./public
|
|
|
|
COPY --from=dashboard_builder /dashboard/package.json ./package.json
|
|
|
|
COPY --from=dashboard_builder /dashboard/.next/standalone ./
|
|
|
|
COPY --from=dashboard_builder /dashboard/.next/static ./.next/static
|
2022-06-03 23:42:23 +03:00
|
|
|
|
2024-03-03 21:05:09 +03:00
|
|
|
WORKDIR /
|
|
|
|
COPY ./start.prod.sh ./start.sh
|
2022-10-08 00:35:48 +03:00
|
|
|
|
2024-03-08 10:49:25 +03:00
|
|
|
EXPOSE 3000 5000 5001
|
2022-06-03 23:42:23 +03:00
|
|
|
|
2024-03-03 21:05:09 +03:00
|
|
|
CMD ["sh", "start.sh"]
|