tldraw/apps/huppy/Dockerfile
Dan Groshev 5953b1cdd4
make Huppy deployable (again) (#2632)
New Next requires a minor Node update. Bumped it _just for this
container_ (ugh), and between the update and new Yarn `yarn workspaces
focus` works and the container builds just fine with Fly CLI. The
Dockerfile hack is now removed.

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package
2024-01-25 12:33:03 +00:00

40 lines
993 B
Docker

# Install dependencies only when needed
FROM node:18.17.0-alpine AS builder
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
RUN corepack enable
WORKDIR /app
COPY . .
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn \
yarn workspaces focus @tldraw/monorepo huppy
ENV NEXT_TELEMETRY_DISABLED 1
WORKDIR /app/apps/huppy
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn build
# Production image, copy all the files and run next
FROM node:18.17.0-alpine AS runner
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
WORKDIR /app
RUN corepack enable
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app ./
USER nextjs
WORKDIR /app/apps/huppy
CMD ["yarn", "start"]