From 975807cdfa826d58d9d49bdc4bcc2311b67f95a0 Mon Sep 17 00:00:00 2001 From: Hayden Hargreaves Date: Wed, 5 Mar 2025 17:01:11 -0700 Subject: [PATCH] FEAT: Frontend dockerfile works and can be run locally. --- frontend/Dockerfile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 frontend/Dockerfile diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..7cf305b --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,41 @@ +# Use a Node.js base image for building +FROM node:18-alpine AS build + +# Set the working directory +WORKDIR /app + +# Copy package.json and package-lock.json (or yarn.lock) +COPY /package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the frontend code +COPY / . + +# Build the React app using Vite +RUN npm run build + +# Use a Node.js base image for serving +FROM node:18-alpine + +# Set the working directory +WORKDIR /app + +# Copy the built React app from the build stage +COPY --from=build /app/dist ./dist + +# Copy package.json and install serve package +COPY /package.json ./ +RUN npm install serve + +# Expose port 3100 +EXPOSE 3100 + +# Start the server +CMD ["npx", "serve", "-s", "dist", "-l", "3100"] + + +# BUILD COMMAND, from ./frontend directory +# docker build -t azpect3120/file.gophernest.frontend:latest . +