Skip to content

Commit

Permalink
chore: 🤖 optimize docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
gmpetrov committed Sep 4, 2023
1 parent 2bb4320 commit f6183f6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,15 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/server ./server
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

# TODO: Improve this. Output file tracing is removing modules needed for workers
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i ; \
else echo "Lockfile not found." && exit 1; \
fi
# # TODO: Improve this. Output file tracing is removing modules needed for workers
# COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
# RUN yarn global add husky
# RUN \
# if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
# elif [ -f package-lock.json ]; then npm ci; \
# elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i ; \
# else echo "Lockfile not found." && exit 1; \
# fi
RUN rm -rf node_modules/.pnpm/canvas@2.11.2

USER nextjs
Expand Down
21 changes: 21 additions & 0 deletions pages/api/load-workers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import '@app/workers/datasource-loader';

import { NextApiResponse } from 'next';

import { AppNextApiRequest } from '@app/types';
import { createApiHandler, respond } from '@app/utils/createa-api-handler';

const handler = createApiHandler();

export const loadWorkers = async (
req: AppNextApiRequest,
res: NextApiResponse
) => {
return {
hello: 'world',
};
};

handler.get(respond(loadWorkers));

export default handler;

0 comments on commit f6183f6

Please sign in to comment.