Iteration 1
This commit is contained in:
parent
c650d1c3d9
commit
0f30fc6ec1
5 changed files with 107 additions and 32 deletions
|
|
@ -1,15 +1,44 @@
|
|||
FROM node:20.18.0-alpine
|
||||
#############################
|
||||
# Build stage
|
||||
#############################
|
||||
|
||||
FROM node:22-alpine AS builder
|
||||
|
||||
ARG NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001
|
||||
ARG NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api
|
||||
ENV NEXT_PUBLIC_WS_URL=${NEXT_PUBLIC_WS_URL}
|
||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||
|
||||
WORKDIR /home/perplexica
|
||||
WORKDIR /app
|
||||
|
||||
COPY ui /home/perplexica/
|
||||
# Copy package.json and yarn.lock
|
||||
COPY ui/package.json ui/yarn.lock ./
|
||||
|
||||
RUN yarn install --frozen-lockfile
|
||||
RUN yarn build
|
||||
# Copy the rest of the application code
|
||||
COPY ui .
|
||||
|
||||
# Install dependencies & build the application
|
||||
RUN yarn install --frozen-lockfile && yarn build
|
||||
|
||||
#############################
|
||||
# Production stage
|
||||
#############################
|
||||
|
||||
FROM node:22-alpine
|
||||
|
||||
ENV NEXT_PUBLIC_WS_URL=ws://localhost:3001
|
||||
ENV NEXT_PUBLIC_API_URL=http://localhost:3001/api
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy built assets from the builder stage
|
||||
COPY --chown=node:node --from=builder /app/.next ./.next
|
||||
COPY --chown=node:node --from=builder /app/node_modules ./node_modules
|
||||
COPY --chown=node:node --from=builder /app/package.json ./package.json
|
||||
COPY --chown=node:node --from=builder /app/public ./public
|
||||
|
||||
# Run the Docker image as node instead of root
|
||||
USER node
|
||||
|
||||
# Start the application
|
||||
CMD ["yarn", "start"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue