-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove turbo & shared-resources from eCR Viewer (#2878)
* update github workflows * move back shared resources and fix build errors * remove shared-resources and turbo from phdi * one more nit * update snapshot test * remove turbo daemon log * update context location in github workflow * add package-lock.json, forgot to add to merge * ran npm ci
- Loading branch information
Showing
27 changed files
with
3,312 additions
and
3,373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,70 @@ | ||
FROM node:18-alpine AS base | ||
|
||
FROM base AS builder | ||
ARG APP_ENV | ||
ENV APP_ENV=${APP_ENV} | ||
|
||
# Install dependencies only when needed | ||
FROM base AS deps | ||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. | ||
RUN apk update | ||
RUN apk add --no-cache libc6-compat | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
RUN npm i -g turbo | ||
COPY . . | ||
ENV TURBO_TELEMETRY_DISABLED=1 | ||
RUN turbo prune ecr-viewer --docker | ||
|
||
# Add lockfile and package.json's of isolated subworkspace | ||
FROM base AS installer | ||
RUN apk update | ||
RUN apk add --no-cache libc6-compat | ||
WORKDIR /app | ||
# Install dependencies based on the preferred package manager | ||
COPY package.json package-lock.json* ./ | ||
RUN npm ci | ||
|
||
# First install the dependencies (as they change less often) | ||
COPY .gitignore .gitignore | ||
COPY --from=builder /app/out/json/ . | ||
COPY --from=builder /app/out/package-lock.json ./package-lock.json | ||
RUN npm i | ||
|
||
# Build the project | ||
COPY --from=builder /app/out/full/ . | ||
COPY turbo.json turbo.json | ||
ENV NEXT_TELEMETRY_DISABLED=1 | ||
ENV TURBO_TELEMETRY_DISABLED=1 | ||
# Rebuild the source code only when needed | ||
FROM base AS builder | ||
WORKDIR /app | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
RUN npx turbo build --filter=ecr-viewer... | ||
# Next.js collects completely anonymous telemetry data about general usage. | ||
# Learn more here: https://nextjs.org/telemetry | ||
# Uncomment the following line in case you want to disable telemetry during the build. | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
RUN npm run build | ||
|
||
# Production image, copy all the files and run next | ||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
# Don't run production as root | ||
# Uncomment the following line in case you want to disable telemetry during runtime. | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
USER nextjs | ||
|
||
COPY --from=installer /app/containers/ecr-viewer/next.config.js . | ||
COPY --from=installer /app/containers/ecr-viewer/package.json . | ||
# COPY --from=builder /app/public ./public | ||
|
||
# Set the correct permission for prerender cache | ||
RUN mkdir .next | ||
RUN chown nextjs:nodejs .next | ||
|
||
# Automatically leverage output traces to reduce image size | ||
# https://nextjs.org/docs/advanced-features/output-file-tracing | ||
COPY --from=installer --chown=nextjs:nodejs /app/containers/ecr-viewer/.next/standalone ./ | ||
COPY --from=installer --chown=nextjs:nodejs /app/containers/ecr-viewer/.next/static ./containers/ecr-viewer/.next/static | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
|
||
USER nextjs | ||
|
||
EXPOSE 3000 | ||
|
||
ENV TURBO_TELEMETRY_DISABLED=1 | ||
ENV NEXT_TELEMETRY_DISABLED=1 | ||
ENV PORT 3000 | ||
ENV HOSTNAME "0.0.0.0" | ||
ENV OTEL_TRACES_EXPORTER=otlp | ||
ENV OTEL_METRICS_EXPORTER=otlp | ||
ENV OTEL_LOGS_EXPORTER=none | ||
|
||
# Prometheus preferred transfer is via HTTP | ||
ENV OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=http/protobuf | ||
ENV OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://otel-collector:4318/v1/metrics | ||
|
||
# Jaeger preferred routing is gRPC for native OTLP | ||
ENV OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc | ||
# Contrary to orchestration, this must be 4318 | ||
ENV OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4318/v1/traces | ||
EXPOSE 3000 | ||
ENV OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4318/v1/traces | ||
|
||
|
||
ENV PORT=3000 | ||
ENV HOSTNAME="0.0.0.0" | ||
CMD ["node", "containers/ecr-viewer/server.js"] | ||
# server.js is created by next build from the standalone output | ||
# https://nextjs.org/docs/pages/api-reference/next-config-js/output | ||
CMD node server.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.