make next.dockerfile more lightweight
ci / build (push) Failing after 11s
Details
ci / build (push) Failing after 11s
Details
This commit is contained in:
parent
3408e7bcd3
commit
a55661164b
|
@ -1,3 +1,6 @@
|
||||||
|
## Important! Build context is the ROOT of the project.
|
||||||
|
## this keeps the door open for future possibility of shared code between pnpm workspace packages
|
||||||
|
|
||||||
FROM node:20-slim AS base
|
FROM node:20-slim AS base
|
||||||
|
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
|
@ -15,24 +18,27 @@ ENV NEXT_PUBLIC_SITE_URL ${NEXT_PUBLIC_SITE_URL}
|
||||||
ENV NEXT_PUBLIC_STRAPI_URL ${NEXT_PUBLIC_STRAPI_URL}
|
ENV NEXT_PUBLIC_STRAPI_URL ${NEXT_PUBLIC_STRAPI_URL}
|
||||||
ENV NEXT_PUBLIC_UPPY_COMPANION_URL ${NEXT_PUBLIC_UPPY_COMPANION_URL}
|
ENV NEXT_PUBLIC_UPPY_COMPANION_URL ${NEXT_PUBLIC_UPPY_COMPANION_URL}
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
COPY package.json pnpm-lock.yaml ./
|
COPY pnpm-lock.yaml package.json ./
|
||||||
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install
|
RUN pnpm fetch
|
||||||
COPY ./packages/next .
|
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install --offline
|
||||||
|
COPY ./packages/next /app
|
||||||
|
|
||||||
|
|
||||||
FROM deps AS dev
|
FROM install AS dev
|
||||||
COPY --from=install /app /app
|
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
|
||||||
CMD ["pnpm", "run", "dev"]
|
CMD ["pnpm", "run", "dev"]
|
||||||
|
|
||||||
|
|
||||||
FROM install AS build
|
|
||||||
COPY --chown=node:node --from=install /app/package.json /app/pnpm-lock.yaml ./
|
|
||||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
|
||||||
COPY --from=install /app /app
|
|
||||||
RUN echo "hello gitea"
|
|
||||||
RUN pnpm run build
|
|
||||||
|
|
||||||
|
FROM install AS build
|
||||||
|
RUN pnpm run build
|
||||||
|
# COPY --chown=node:node --from=install /app/package.json /app/pnpm-lock.yaml ./
|
||||||
|
# RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
||||||
|
# COPY --from=install /app /app # i think this is duplicate
|
||||||
|
# can't get these to work because errors like "/prod/next/.next/standalone": not found
|
||||||
|
# as if pnpm is not copying the build artifacts.
|
||||||
|
# also this makes the build REALLY slow (adds ~10mins to build time)
|
||||||
|
# RUN pnpm deploy --filter=@futureporn/next --prod /prod/next
|
||||||
|
# RUN pnpm deploy --filter=@futureporn/link2cid --prod /prod/link2cid
|
||||||
|
|
||||||
# FROM deps as release
|
# FROM deps as release
|
||||||
# # ENV NEXT_SHARP_PATH=/app/node_modules/sharp
|
# # ENV NEXT_SHARP_PATH=/app/node_modules/sharp
|
||||||
|
@ -45,7 +51,7 @@ RUN pnpm run build
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FROM install AS release
|
FROM deps AS next
|
||||||
RUN apt-get update && apt-get install -y -qq --no-install-recommends dumb-init
|
RUN apt-get update && apt-get install -y -qq --no-install-recommends dumb-init
|
||||||
COPY --chown=node:node --from=build /app/package.json /app/pnpm-lock.yaml ./
|
COPY --chown=node:node --from=build /app/package.json /app/pnpm-lock.yaml ./
|
||||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
||||||
|
@ -56,3 +62,4 @@ ENV TZ=UTC
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV HOSTNAME="0.0.0.0"
|
ENV HOSTNAME="0.0.0.0"
|
||||||
CMD [ "dumb-init", "node", "server.js" ]
|
CMD [ "dumb-init", "node", "server.js" ]
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
node_modules
|
|
@ -0,0 +1,3 @@
|
||||||
|
node_modules
|
||||||
|
.env
|
||||||
|
*~
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "link2cid",
|
"name": "@futureporn/link2cid",
|
||||||
"version": "3.2.0",
|
"version": "3.2.0",
|
||||||
"description": "REST API for adding files to IPFS",
|
"description": "REST API for adding files to IPFS",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "fp-next",
|
"name": "@futureporn/next",
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "futureporn-strapi",
|
"name": "@futureporn/strapi",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "A Strapi application",
|
"description": "A Strapi application",
|
||||||
|
|
Loading…
Reference in New Issue