Skip to content

Commit

Permalink
Dockerize webapp and webapi
Browse files Browse the repository at this point in the history
  • Loading branch information
prasadhonrao committed Oct 28, 2024
1 parent 4bc5919 commit 1b7ce26
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/webapi/dockerize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker build -t prasadhonrao/devcamper-webapi .
docker push prasadhonrao/devcamper-webapi
17 changes: 13 additions & 4 deletions src/webapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use the official Node.js image as the base image
FROM node:14-alpine
# Stage 1: Build the React application
FROM node:14 AS build

# Set the working directory
WORKDIR /app
Expand All @@ -20,11 +20,20 @@ ENV REACT_APP_DEVCAMPER_BASE_API_URI=${REACT_APP_DEVCAMPER_BASE_API_URI}
# Build the React application
RUN npm run build

# Stage 2: Serve the React application
FROM node:14 AS serve

# Install a simple HTTP server to serve the static files
RUN npm install -g serve

# Set the working directory
WORKDIR /app

# Copy the build artifacts from the previous stage
COPY --from=build /app/build ./build

# Expose the port the app runs on
EXPOSE 3000

# Start the application
CMD ["serve", "-s", "build", "-l", "3000"]
# Serve the React application
CMD ["serve", "-s", "build"]
2 changes: 2 additions & 0 deletions src/webapp/dockerize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker build -t prasadhonrao/devcamper-webapp .
docker push prasadhonrao/devcamper-webapp

0 comments on commit 1b7ce26

Please sign in to comment.