Skip to content

Commit

Permalink
web runner
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
  • Loading branch information
jasonmadigan committed Jan 29, 2025
1 parent 59c16ab commit 4b1077a
Show file tree
Hide file tree
Showing 13 changed files with 559 additions and 261 deletions.
46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Stage 1: Build the React app
FROM node:18-alpine AS build

# Set working directory
WORKDIR /app

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

# Install dependencies
RUN npm install

# Copy all files
COPY . .

# Build the React app
RUN npm run build

# Stage 2: Serve the app with Express
FROM node:18-alpine

# Set working directory
WORKDIR /app

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

# Install only production dependencies
RUN npm install --only=production

# Copy built React app from Stage 1
COPY --from=build /app/build ./build

# Copy server.js
COPY server.js ./

# Expose port
EXPOSE 5000

# Define environment variables (can be overridden at runtime)
ENV PORT=5000
ENV WEBSOCKET_HOST=localhost
ENV WEBSOCKET_PORT=4000

# Start the server
CMD ["node", "server.js"]
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,26 @@ Contributions are welcome! Please open an issue or submit a pull request.
## License

This project is licensed under the Apache v2 License.














```bash
docker build -t my-app .

# Run the Docker container with environment variables
docker run -d -p 5000:5000 \
-e WEBSOCKET_HOST=your.websocket.host \
-e WEBSOCKET_PORT=1234 \
my-app
```
234 changes: 185 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4b1077a

Please sign in to comment.