saleor-apps-redis_apl/apps/search/app.prod.Dockerfile
Lukasz Ostrowski 7240f6efa7 Add docker, prisma and worker POC
Add docker-compose with Postgres

Install Prisma and generate empty schema

Install Prisma client

Add app config model and migration

Add repository for Algolia Configuration

Migrate metadata to postgres

Replace webhooks metadata with PRisma

Add worker and skeleton code

Implement worker job and removed from the frontend

Attempt to display jobs list

Worker utils

Run worker in the same thread on dev

Run worker in the same thread on dev

Build scripts

fix dev mode

Dockerfiles

prod dockerfiles

docker wip

docker wip

wip working docker

wip working docker

wip - working without prisma migrate
2023-06-07 11:07:37 +02:00

71 lines
No EOL
1.9 KiB
Docker

# Source
# https://turbo.build/repo/docs/handbook/deploying-with-docker#example
# TODO https://pnpm.io/cli/fetch
FROM node:18 AS base
FROM base AS builder
#RUN apk add --no-cache libc6-compat
#RUN apk update
# Set working directory
WORKDIR /app
RUN yarn global add turbo@1.9.1
RUN yarn global add pnpm@8.2.0
# Copy entire monorepo
COPY . .
RUN turbo prune --scope="saleor-app-search" --docker
# Add lockfile and package.json's of isolated subworkspace
FROM base AS installer
#RUN apk add --no-cache libc6-compat
#RUN apk update
WORKDIR /app
RUN yarn global add pnpm@8.2.0
ARG DATABASE_URL
ENV DATABASE_URL=${DATABASE_URL}
# First install the dependencies (as they change less often)
COPY .gitignore .gitignore
COPY --from=builder /app/out/full/ .
#COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=builder /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml
RUN pnpm install --frozen-lockfile
# Build the project
#COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json
RUN pnpm turbo run build:app --filter="saleor-app-search"
FROM base AS runner
WORKDIR /app
ARG DATABASE_URL
ENV DATABASE_URL=${DATABASE_URL}
# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs
COPY --from=installer /app/apps/search/next.config.js .
COPY --from=installer /app/apps/search/package.json .
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=installer --chown=nextjs:nodejs /app/apps/search/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/apps/search/.next/static ./apps/search/.next/static
COPY --from=installer --chown=nextjs:nodejs /app/apps/search/public ./apps/search/public
COPY --from=installer --chown=nextjs:nodejs /app/apps/search/prisma ./apps/search/prisma
CMD ["node", "apps/search/server.js"]
# TODO Another entrypoint for worker