Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ternaus committed Nov 15, 2024
1 parent 999e00b commit 8877a82
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 9 additions & 12 deletions website/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ FROM node:20-slim
RUN mkdir -p /website /home/node/.cache/node/corepack && \
chown -R node:node /website /home/node/.cache

# Enable corepack before switching to non-root user
# RUN corepack enable
# Remove system yarn and enable corepack
RUN rm -rf /usr/local/bin/yarn && \
corepack enable && \
corepack prepare [email protected] --activate

# Switch to non-root user
USER node
Expand All @@ -22,23 +24,18 @@ ENV PATH /website/node_modules/.bin:$PATH
# Copy package files with correct ownership
COPY --chown=node:node website/package.json website/yarn.lock ./

# Setup Yarn
RUN yarn set version 4.5.1

# Install dependencies
RUN yarn install

RUN yarn add next
# Install dependencies using Yarn 4
RUN corepack yarn install

# Copy the rest of the application
COPY --chown=node:node website .

# Expose port
EXPOSE 3000

# Set the command
# Set the command using explicit yarn path
CMD if [ "$NODE_ENV" = "production" ]; then \
yarn dlx next build; \
corepack yarn build; \
else \
yarn dlx next dev; \
corepack yarn dev; \
fi

0 comments on commit 8877a82

Please sign in to comment.