diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ed29fb5..9bb632b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,7 @@ jobs: uses: actions/checkout@v4 with: submodules: true + fetch-depth: 1 # fix for when this gets triggered by tag fetch-tags: true token: ${{ secrets.GITHUB_TOKEN }} @@ -78,6 +79,21 @@ jobs: # set latest tag for stable releases type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.release.prerelease == false }} + - name: Cache + uses: actions/cache@v4 + id: cache + with: + path: cache-mount + key: cache-mount-${{ hashFiles('Dockerfile') }} + + - name: Restore Docker cache mounts + uses: reproducible-containers/buildkit-cache-dance@v3 + with: + builder: ${{ steps.setup-buildx.outputs.name }} + cache-dir: cache-mount + dockerfile: Dockerfile + skip-extraction: ${{ steps.cache.outputs.cache-hit }} + - name: Build and push image id: build-and-push uses: docker/build-push-action@v6 diff --git a/Dockerfile b/Dockerfile index 19e6a84..5eb5512 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,47 @@ # syntax=docker/dockerfile:1 -# Unified deps builder -FROM node:lts-alpine AS deps -WORKDIR /app -COPY package.json yarn.lock ./ -RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --network-timeout 1000000 --ignore-scripts +### Unified deps builder +# FROM node:lts-alpine AS deps +# WORKDIR /app +# COPY package.json yarn.lock ./ +# RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --network-timeout 1000000 --ignore-scripts -# Build for app +### Build for app FROM node:lts-alpine AS build-system # setup workdir - has to be the same filepath as app because fuckin' Prisma WORKDIR /app ENV NODE_ENV=production ENV NUXT_TELEMETRY_DISABLED=1 -ENV YARN_CACHE_FOLDER=/root/.yarn +# ENV YARN_CACHE_FOLDER=/root/.yarn # add git so drop can determine its git ref at build -RUN apk add --no-cache git +# pnpm for build +RUN apk add --no-cache git pnpm # copy deps and rest of project files -COPY --from=deps /app/node_modules ./node_modules +# COPY --from=deps /app/node_modules ./node_modules COPY . . ARG BUILD_DROP_VERSION ARG BUILD_GIT_REF # build -RUN --mount=type=cache,target=/root/.yarn yarn postinstall && \ - yarn build +RUN pnpm import +RUN pnpm install --shamefully-hoist +RUN pnpm run build +# RUN --mount=type=cache,target=/root/.yarn yarn postinstall && yarn build -# create run environment for Drop +### create run environment for Drop FROM node:lts-alpine AS run-system WORKDIR /app ENV NODE_ENV=production ENV NUXT_TELEMETRY_DISABLED=1 -RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn add --network-timeout 1000000 --no-lockfile --ignore-scripts prisma@6.11.1 +# RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn add --network-timeout 1000000 --no-lockfile --ignore-scripts prisma@6.11.1 +RUN apk add --no-cache pnpm +RUN pnpm install prisma@6.11.1 COPY --from=build-system /app/package.json ./ COPY --from=build-system /app/.output ./app diff --git a/build/launch.sh b/build/launch.sh index 173b311..4a44e90 100755 --- a/build/launch.sh +++ b/build/launch.sh @@ -2,7 +2,7 @@ # This file starts up the Drop server by running migrations and then starting the executable echo "[Drop] performing migrations..." -yarn prisma migrate deploy +pnpm prisma migrate deploy # Actually start the application node /app/app/server/index.mjs diff --git a/package.json b/package.json index 77fb6c6..3a06bab 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,6 @@ "typescript": "^5.8.3", "vue-tsc": "^3.0.1" }, - "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e", "overrides": { "vue3-carousel-nuxt": { "vue3-carousel": "^0.16.0" diff --git a/yarn.lock b/yarn.lock index d6bd269..f0f5195 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2898,7 +2898,7 @@ resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.5.18.tgz#529f24a88d3ed678d50fd5c07455841fbe8ac95e" integrity sha512-cZy8Dq+uuIXbxCZpuLd2GJdeSO/lIzIspC2WtkqIpje5QyFbvLaI5wZtdUjLHjGZrlVX6GilejatWwVYYRc8tA== -"@vueuse/core@13.6.0": +"@vueuse/core@13.6.0", "@vueuse/core@^13.6.0": version "13.6.0" resolved "https://registry.yarnpkg.com/@vueuse/core/-/core-13.6.0.tgz#4137f63dc4cef2ff8ae74ee146d6b6070d707878" integrity sha512-DJbD5fV86muVmBgS9QQPddVX7d9hWYswzlf4bIyUD2dj8GC46R1uNClZhVAmsdVts4xb2jwp1PbpuiA50Qee1A==