Skip to content

Commit

Permalink
fix: attempt to resolve #174
Browse files Browse the repository at this point in the history
  • Loading branch information
hunghvu committed Oct 3, 2024
1 parent 9b584fa commit e99d4fd
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
15 changes: 9 additions & 6 deletions apps/cms/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN apk update

WORKDIR /app
COPY . .
ENV SKIP_YARN_COREPACK_CHECK=0
RUN yarn global add turbo
RUN turbo prune cms --docker

Expand All @@ -24,12 +25,13 @@ COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json

ENV SKIP_YARN_COREPACK_CHECK=0
RUN yarn global add turbo
RUN yarn global add pnpm@9.0.4
RUN yarn global add pnpm
RUN yarn global add dotenv-cli
RUN pnpm install

ENV NODE_ENV production
ENV NODE_ENV=production
RUN pnpm run build --filter cms

FROM base AS runner
Expand All @@ -50,10 +52,11 @@ COPY --from=installer --chown=payload:nodejs /app/apps/cms/node_modules ./apps/c
COPY --from=installer --chown=payload:nodejs /app/node_modules/.pnpm ./node_modules/.pnpm

# Runtime environment variables
ENV PAYLOAD_PUBLIC_SERVER_URL https://payload.hungvu.tech
ENV PAYLOAD_FRONT_END_DOMAIN hungvu.tech
ENV PAYLOAD_BACK_END_DOMAIN payload.hungvu.tech
ENV PAYLOAD_PORT 3100
ENV PAYLOAD_PUBLIC_SERVER_URL=https://payload.hungvu.tech
ENV PAYLOAD_FRONT_END_DOMAIN=hungvu.tech
ENV PAYLOAD_BACK_END_DOMAIN=payload.hungvu.tech
ENV PAYLOAD_PORT=3100

ENV SKIP_YARN_COREPACK_CHECK=0
WORKDIR /app/apps/cms
CMD yarn run serve
35 changes: 18 additions & 17 deletions apps/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ FROM base AS builder
RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /app
ENV SKIP_YARN_COREPACK_CHECK=0
RUN yarn global add turbo
COPY . .
RUN turbo prune web --docker
Expand All @@ -21,9 +22,9 @@ COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json


ENV SKIP_YARN_COREPACK_CHECK=0
RUN yarn global add turbo
RUN yarn global add pnpm@9.0.4
RUN yarn global add pnpm
RUN yarn global add dotenv-cli
# pnpm install cannot run after NODE_ENV production, or else it skips devDependencies
# and breaks turborepo setup
Expand All @@ -33,29 +34,29 @@ ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_ENV production

# Public environment variables, only for build time
ENV NEXT_PUBLIC_BASE_URL https://hungvu.tech
ENV NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION EGTdZytY_C05esF562wX0i-fpIShKgfypgbhQV3bPzU
ENV NEXT_PUBLIC_API_OPENWRT_TOH_FILTER https://hungvu.tech/api/openwrt-toh/filter
ENV NEXT_PUBLIC_BASE_URL=https://hungvu.tech
ENV NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION=EGTdZytY_C05esF562wX0i-fpIShKgfypgbhQV3bPzU
ENV NEXT_PUBLIC_API_OPENWRT_TOH_FILTER=https://hungvu.tech/api/openwrt-toh/filter

# Global content material
ENV NEXT_REQUEST_CMS_STATIC_ROUTE_METADATA_URL https://payload.hungvu.tech/api/static-route-metadata
ENV NEXT_REQUEST_CMS_STATIC_ROUTE_METADATA_URL=https://payload.hungvu.tech/api/static-route-metadata

# Media
ENV NEXT_REQUEST_CMS_MEDIA_URL https://payload.hungvu.tech/api/media
ENV NEXT_REQUEST_CMS_MEDIA_URL=https://payload.hungvu.tech/api/media

# Blog
ENV NEXT_REQUEST_CMS_ARTICLES_URL https://payload.hungvu.tech/api/articles
ENV NEXT_REQUEST_CMS_ARTICLES_IGNORE_REDUNDANT_FIELDS_URL https://payload.hungvu.tech/api/articles/ignore-redundant-fields
ENV NEXT_REQUEST_CMS_ARTICLES_IN_THE_SAME_SERIES_URL https://payload.hungvu.tech/api/articles/in-series
ENV NEXT_REQUEST_CMS_ARTICLES_URL=https://payload.hungvu.tech/api/articles
ENV NEXT_REQUEST_CMS_ARTICLES_IGNORE_REDUNDANT_FIELDS_URL=https://payload.hungvu.tech/api/articles/ignore-redundant-fields
ENV NEXT_REQUEST_CMS_ARTICLES_IN_THE_SAME_SERIES_URL=https://payload.hungvu.tech/api/articles/in-series

# Lab
ENV NEXT_REQUEST_CMS_LABS_URL https://payload.hungvu.tech/api/labs
ENV NEXT_REQUEST_CMS_LABS_IGNORE_REDUNDANT_FIELDS_URL https://payload.hungvu.tech/api/labs/ignore-redundant-fields
ENV NEXT_REQUEST_CMS_LABS_URL=https://payload.hungvu.tech/api/labs
ENV NEXT_REQUEST_CMS_LABS_IGNORE_REDUNDANT_FIELDS_URL=https://payload.hungvu.tech/api/labs/ignore-redundant-fields

# Lab - OpenWRT TOH
ENV NEXT_REQUEST_CMS_OPENWRT_TOH_URL https://payload.hungvu.tech/api/openwrt-toh
ENV NEXT_REQUEST_CMS_OPENWRT_TOH_AVAILABLE_VALUES_OF_EACH_FIELD_URL https://payload.hungvu.tech/api/openwrt-toh/available-values-of-each-field
ENV NEXT_REQUEST_CMS_OPENWRT_TOH_FILTER_URL https://payload.hungvu.tech/api/openwrt-toh/filter
ENV NEXT_REQUEST_CMS_OPENWRT_TOH_URL=https://payload.hungvu.tech/api/openwrt-toh
ENV NEXT_REQUEST_CMS_OPENWRT_TOH_AVAILABLE_VALUES_OF_EACH_FIELD_URL=https://payload.hungvu.tech/api/openwrt-toh/available-values-of-each-field
ENV NEXT_REQUEST_CMS_OPENWRT_TOH_FILTER_URL=https://payload.hungvu.tech/api/openwrt-toh/filter
RUN pnpm run build --filter web

FROM base AS runner
Expand All @@ -72,8 +73,8 @@ COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public

ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production

# It seems these are required for both build and runtime
# For build time, it is so Next.js can generate cache files
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Author: Hung Vu

version: "3.8"

services:
# MongoDB Atlas does not support IPv6, so self hosting is a stopgap solution
mongo:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
},
"engines": {
"node": ">=20.0.0"
}
},
"packageManager": "[email protected]"
}

0 comments on commit e99d4fd

Please sign in to comment.