mirror of
https://github.com/smolgrrr/TAO.git
synced 2024-09-20 17:31:26 +00:00
22 lines
801 B
Docker
22 lines
801 B
Docker
|
# Stage 1: Building the React application
|
||
|
FROM node:18-alpine AS build
|
||
|
WORKDIR /app
|
||
|
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 --frozen-lockfile; \
|
||
|
else echo "Lockfile not found." && exit 1; \
|
||
|
fi
|
||
|
COPY . .
|
||
|
RUN yarn build # or `npm run build` if using npm
|
||
|
|
||
|
# Stage 2: Setting up Nginx to serve the React application
|
||
|
FROM nginx:alpine AS production
|
||
|
# Copy built assets from 'build' stage
|
||
|
COPY --from=build /app/build /usr/share/nginx/html
|
||
|
# Optional: If you have a custom nginx.conf, you can copy it to the container
|
||
|
# COPY nginx.conf /etc/nginx/nginx.conf
|
||
|
EXPOSE 80
|
||
|
CMD ["nginx", "-g", "daemon off;"]
|