Skip to content

Commit

Permalink
feat: Dockerize application for production deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
wryonik committed Sep 19, 2024
1 parent d95aea7 commit 8ce5a9a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
build
*.log
2 changes: 0 additions & 2 deletions .env.base-sepolia

This file was deleted.

33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Use an official Node.js runtime as a parent image
FROM node:18 AS build

# Set the working directory in the container
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN yarn install

# Copy the rest of the application code
COPY . .

ENV GENERATE_SOURCEMAP=false
ENV NODE_OPTIONS="--max-old-space-size=2048"


# Build the React application
RUN yarn build

# Use a smaller image to serve the application
FROM nginx:alpine

# Copy the built application from the build stage
COPY --from=build /app/dist /usr/share/nginx/html

# Expose port 80 for the application
EXPOSE 80

# Start Nginx server
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit 8ce5a9a

Please sign in to comment.