convert strapi to use pnpm
ci / build (push) Failing after 3m59s Details

This commit is contained in:
Chris Grimmett 2024-04-02 06:49:33 -08:00
parent 203cc91f31
commit 2d2f8ced9b
14 changed files with 353 additions and 12416 deletions

View File

@ -1,15 +1,42 @@
include .env
all: minikube secrets tilt
tilt:
tilt up
secrets:
kubectl delete secret link2cid --ignore-not-found
kubectl create secret generic link2cid \
--from-literal=apiKey=${LINK2CID_API_KEY}
kubectl delete secret vultr
kubectl delete secret vultr --ignore-not-found
kubectl create secret generic vultr \
--from-literal=vultr=${VULTR_CONTAINER_REGISTRY_USERNAME}
kubectl delete secret strapi --ignore-not-found
kubectl create secret generic strapi \
--from-literal=adminJwtSecret=${STRAPI_ADMIN_JWT_SECRET} \
--from-literal=apiTokenSalt=${STRAPI_API_TOKEN_SALT} \
--from-literal=appKeys=${APP_KEYS} \
--from-literal=databaseUrl=postgres://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME} \
--from-literal=jwtSecret=${STRAPI_JWT_SECRET} \
--from-literal=muxPlaybackRestrictionId=${MUX_PLAYBACK_RESTRICTION_ID} \
--from-literal=muxSigningKeyPrivateKey=${MUX_SIGNING_KEY_PRIVATE_KEY} \
--from-literal=s3UscBucketApplicationKey=${S3_USC_BUCKET_APPLICATION_KEY} \
--from-literal=s3UscBucketEndpoint=${S3_USC_BUCKET_ENDPOINT} \
--from-literal=s3UscBucketName=${S3_USC_BUCKET_NAME} \
--from-literal=s3UscBucketKeyId=${S3_USC_BUCKET_KEY_ID} \
--from-literal=s3UscBucketRegion=${S3_USC_BUCKET_REGION} \
--from-literal=muxSigningKeyId=${MUX_SIGNING_KEY_ID} \
--from-literal=strapiAdminEmail=${STRAPI_ADMIN_EMAIL} \
--from-literal=sendgridApiKey=${SENDGRID_API_KEY} \
--from-literal=cdnBucketUscUrl=${CDN_BUCKET_USC_URL} \
--from-literal=transferTokenSalt=${TRANSFER_TOKEN_SALT}
# --from-literal=sessionSecret=$(SESSION_SECRET) \
# --from-literal=twitchClientId=$(TWITCH_CLIENT_ID) \

View File

@ -9,7 +9,9 @@ k8s_yaml(helm(
docker_build('fp/link2cid', './packages/link2cid')
docker_build(
'fp/strapi',
'./packages/strapi',
'.',
dockerfile='strapi.dockerfile',
target='dev',
live_update=[
sync('./packages/strapi', '/app')
]
@ -60,13 +62,13 @@ k8s_resource(
# port_forwards=['5050']
# )
# k8s_resource(
# workload='strapi-pod',
# port_forwards=['1337'],
# links=[
# link('http://localhost:1337/admin', 'Strapi Admin UI')
# ]
# )
k8s_resource(
workload='strapi-pod',
port_forwards=['1337'],
links=[
link('http://localhost:1337/admin', 'Strapi Admin UI')
]
)
# v1alpha1.extension_repo(name='default', url='https://github.com/tilt-dev/tilt-extensions')

View File

@ -13,27 +13,27 @@ spec:
valueFrom:
secretKeyRef:
name: strapi
key: ADMIN_JWT_SECRET
key: adminJwtSecret
- name: API_TOKEN_SALT
valueFrom:
secretKeyRef:
name: strapi
key: API_TOKEN_SALT
key: apiTokenSalt
- name: APP_KEYS
valueFrom:
secretKeyRef:
name: strapi
key: APP_KEYS
key: appKeys
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: strapi
key: DATABASE_URL
key: databaseUrl
- name: CDN_BUCKET_USC_URL
valueFrom:
secretKeyRef:
name: strapi
key: CDN_BUCKET_USC_URL
key: cdnBucketUscUrl
- name: DATABASE_CLIENT
value: postgres
- name: DATABASE_HOST
@ -44,61 +44,61 @@ spec:
valueFrom:
secretKeyRef:
name: strapi
key: JWT_SECRET
key: jwtSecret
- name: MUX_PLAYBACK_RESTRICTION_ID
valueFrom:
secretKeyRef:
name: strapi
key: MUX_PLAYBACK_RESTRICTION_ID
key: muxPlaybackRestrictionId
- name: MUX_SIGNING_KEY_ID
valueFrom:
secretKeyRef:
name: strapi
key: MUX_SIGNING_KEY_ID
key: muxSigningKeyId
- name: MUX_SIGNING_KEY_PRIVATE_KEY
valueFrom:
secretKeyRef:
name: strapi
key: MUX_SIGNING_KEY_PRIVATE_KEY
key: muxSigningKeyPrivateKey
- name: NODE_ENV
value: production
- name: S3_USC_BUCKET_APPLICATION_KEY
valueFrom:
secretKeyRef:
name: strapi
key: S3_USC_BUCKET_APPLICATION_KEY
key: s3UscBucketApplicationKey
- name: S3_USC_BUCKET_ENDPOINT
valueFrom:
secretKeyRef:
name: strapi
key: S3_USC_BUCKET_ENDPOINT
key: s3UscBucketEndpoint
- name: S3_USC_BUCKET_KEY_ID
valueFrom:
secretKeyRef:
name: strapi
key: S3_USC_BUCKET_KEY_ID
key: s3UscBucketKeyId
- name: S3_USC_BUCKET_NAME
valueFrom:
secretKeyRef:
name: strapi
key: S3_USC_BUCKET_NAME
key: s3UscBucketName
- name: S3_USC_BUCKET_REGION
valueFrom:
secretKeyRef:
name: strapi
key: S3_USC_BUCKET_REGION
key: s3UscBucketRegion
- name: SENDGRID_API_KEY
valueFrom:
secretKeyRef:
name: strapi
key: SENDGRID_API_KEY
key: sendgridApiKey
- name: STRAPI_URL
value: {{ .Values.strapi.url }}
- name: TRANSFER_TOKEN_SALT
valueFrom:
secretKeyRef:
name: strapi
key: TRANSFER_TOKEN_SALT
key: transferTokenSalt
- name: PORT
value: "{{ .Values.strapi.port }}"
resources:

View File

@ -0,0 +1,9 @@
.tmp/
.cache/
.git/
.env
build/
node_modules/
# Ignoring folders that might be used in starter templates
data/
backup/

View File

@ -1,28 +0,0 @@
# Creating multi-stage build for production
FROM node:18-alpine as build
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev git > /dev/null 2>&1
ENV NODE_ENV=production
WORKDIR /opt/
COPY package.json yarn.lock ./
RUN yarn global add node-gyp
RUN yarn config set network-timeout 600000 -g && yarn install --production
ENV PATH /opt/node_modules/.bin:$PATH
WORKDIR /opt/app
COPY . .
RUN yarn build
# Creating final production image
FROM node:18-alpine
RUN apk add --no-cache vips-dev
ENV NODE_ENV=production
WORKDIR /opt/
COPY --from=build /opt/node_modules ./node_modules
WORKDIR /opt/app
COPY --from=build /opt/app ./
ENV PATH /opt/node_modules/.bin:$PATH
RUN chown -R node:node /opt/app
USER node
EXPOSE 1337
CMD ["yarn", "start"]

View File

@ -1,26 +0,0 @@
FROM node:18.16-alpine as base
RUN corepack enable
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}
WORKDIR /app
FROM base AS build
COPY package.json pnpm-lock.yaml ./
# RUN yarn config set network-timeout 600000 -g && yarn install
RUN pnpm install --frozen-lockfile
COPY . .
ENV PATH=/app/node_modules/.bin:$PATH
RUN chown -R node:node /app
USER node
RUN pnpm run build
EXPOSE 1337
FROM build AS dev
CMD ["pnpm", "run", "dev"]
FROM build AS release
ENTRYPOINT ["pnpm", "run", "start"]

View File

@ -1,31 +0,0 @@
# Creating multi-stage build for production
FROM node:18-alpine as build
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev git > /dev/null 2>&1
ENV NODE_ENV=production
WORKDIR /opt/
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --prod
ENV PATH /opt/node_modules/.bin:$PATH
WORKDIR /opt/app
COPY . .
RUN pnpm run build
# Creating final production image
FROM node:18-alpine
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN apk add --no-cache vips-dev
ENV NODE_ENV=production
WORKDIR /opt/
COPY --from=build /opt/node_modules ./node_modules
WORKDIR /opt/app
COPY --from=build /opt/app ./
ENV PATH /opt/node_modules/.bin:$PATH
RUN chown -R node:node /opt/app
USER node
EXPOSE 1337
CMD ["pnpm", "start"]

View File

@ -1,19 +0,0 @@
FROM node:18-alpine
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev git
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}
WORKDIR /opt/
COPY package.json yarn.lock ./
RUN yarn global add node-gyp
RUN yarn config set network-timeout 600000 -g && yarn install
ENV PATH /opt/node_modules/.bin:$PATH
WORKDIR /opt/app
COPY . .
RUN chown -R node:node /opt/app
USER node
RUN ["yarn", "build"]
EXPOSE 1337
CMD ["yarn", "dev"]

View File

@ -63,7 +63,7 @@
"react-router-dom": "5.3.4",
"react-test-renderer": "^17.0.2",
"semver": "^7.5.4",
"sharp": "^0.32.6",
"sharp": "0.32.6",
"strapi-plugin-fuzzy-search": "^2.2.0",
"styled-components": "5.3.3",
"typescript": "^5.3.3",
@ -81,7 +81,7 @@
"uuid": false
},
"engines": {
"node": ">=14.19.1 <=18.x.x",
"node": ">=14.19.1 <=19.x.x",
"npm": ">=6.0.0"
},
"license": "MIT"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,5 +2,5 @@ packages:
- 'packages/uppy'
- 'packages/bot'
- 'packages/next'
# strapi is not on here because it's not compatible with pnpm
- 'packages/strapi'

51
strapi.dockerfile Normal file
View File

@ -0,0 +1,51 @@
# FROM node:18-alpine
# # Installing libvips-dev for sharp Compatibility
# RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev git
# ARG NODE_ENV=development
# ENV NODE_ENV=${NODE_ENV}
# WORKDIR /opt/
# COPY ./packages/strapi/package.json ./packages/strapi/yarn.lock ./
# RUN yarn global add node-gyp
# RUN yarn config set network-timeout 600000 -g && yarn install
# ENV PATH /opt/node_modules/.bin:$PATH
# WORKDIR /opt/app
# COPY ./packages/strapi .
# RUN chown -R node:node /opt/app
# USER node
# RUN ["yarn", "build"]
# EXPOSE 1337
# CMD ["yarn", "dev"]
FROM node:18.16-alpine as base
RUN corepack enable
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}
WORKDIR /app
FROM base AS build
# COPY package.json pnpm-lock.yaml ./
COPY pnpm-lock.yaml ./
# RUN yarn config set network-timeout 600000 -g && yarn install
# RUN pnpm install --frozen-lockfile
RUN pnpm fetch
COPY ./packages/strapi .
RUN pnpm install --offline
# ENV PATH=/app/node_modules/.bin:$PATH
RUN chown -R node:node /app
USER node
# RUN pnpm run build
# EXPOSE 1337
FROM build AS dev
CMD ["pnpm", "run", "dev"]
FROM build AS release
CMD ["pnpm"]
ENTRYPOINT ["run", "start"]