-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docker to all components. #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Build stage | ||
FROM node:latest AS builder | ||
|
||
WORKDIR /app | ||
COPY ./ . | ||
|
||
RUN corepack enable | ||
RUN yarn install | ||
RUN yarn build | ||
|
||
# Nginx stage | ||
FROM nginx:latest | ||
|
||
# Set the working directory for Nginx | ||
WORKDIR /app | ||
|
||
# Copy the build output from the builder stage to Nginx's default directory | ||
COPY --from=builder /app/dist /usr/share/nginx/html | ||
|
||
RUN mkdir /usr/share/nginx/html/snippy | ||
RUN mv /usr/share/nginx/html/assets /usr/share/nginx/html/snippy/assets | ||
|
||
# Optionally copy a custom Nginx config (if you have one) | ||
COPY ./nginx.conf /etc/nginx/nginx.conf | ||
|
||
# Expose port 80 to access the app | ||
EXPOSE 80 | ||
|
||
# Nginx will automatically serve the content | ||
CMD ["nginx", "-g", "daemon off;"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,15 @@ | ||
# Getting Started with Create React App | ||
# Client application | ||
|
||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). | ||
Useful commands: | ||
|
||
## Available Scripts | ||
```sh | ||
yarn start | ||
yarn build | ||
yarn lint | ||
yarn lint-fix | ||
yarn deploy | ||
``` | ||
|
||
In the project directory, you can run: | ||
## Running locally | ||
|
||
### `npm start` | ||
|
||
Runs the app in the development mode.\ | ||
Open [http://localhost:3000](http://localhost:3000) to view it in your browser. | ||
|
||
The page will reload when you make changes.\ | ||
You may also see any lint errors in the console. | ||
|
||
### `npm test` | ||
|
||
Launches the test runner in the interactive watch mode.\ | ||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. | ||
|
||
### `npm run build` | ||
|
||
Builds the app for production to the `build` folder.\ | ||
It correctly bundles React in production mode and optimizes the build for the best performance. | ||
|
||
The build is minified and the filenames include the hashes.\ | ||
Your app is ready to be deployed! | ||
|
||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. | ||
|
||
### `npm run eject` | ||
|
||
**Note: this is a one-way operation. Once you `eject`, you can't go back!** | ||
|
||
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. | ||
|
||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. | ||
|
||
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. | ||
|
||
## Learn More | ||
|
||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). | ||
|
||
To learn React, check out the [React documentation](https://reactjs.org/). | ||
|
||
### Code Splitting | ||
|
||
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) | ||
|
||
### Analyzing the Bundle Size | ||
|
||
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) | ||
|
||
### Making a Progressive Web App | ||
|
||
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) | ||
|
||
### Advanced Configuration | ||
|
||
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) | ||
|
||
### Deployment | ||
|
||
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) | ||
|
||
### `npm run build` fails to minify | ||
|
||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) | ||
Either run `yarn start` or use the container instructions on the main README. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# The "events" section is required by Nginx | ||
events { | ||
worker_connections 1024; # Maximum number of simultaneous connections | ||
} | ||
|
||
http { | ||
# Basic HTTP setup | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
upstream backend { | ||
server wasi-runner:3001; | ||
} | ||
|
||
server { | ||
listen 80; | ||
|
||
# Serve static files from /usr/share/nginx/html | ||
root /usr/share/nginx/html; | ||
|
||
# Default index file | ||
index index.html; | ||
|
||
# Redirect any request to / to index.html (for SPA routing) | ||
location / { | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
# Proxy requests to /api to wasi-runner:3000 | ||
location /api/ { | ||
proxy_pass http://backend; | ||
|
||
# WebSocket headers | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
|
||
# Preserve host and real IP headers | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
|
||
# Optional timeout settings for WebSockets | ||
proxy_read_timeout 3600s; | ||
proxy_send_timeout 3600s; | ||
} | ||
|
||
# Optional: Add headers to cache static assets for better performance | ||
location ~* \.(?:css|js|html|svg|woff2?|ttf|eot)$ { | ||
try_files $uri =404; | ||
add_header Cache-Control "public, max-age=31536000, immutable"; | ||
} | ||
|
||
# Optional: Handle 404 errors gracefully | ||
error_page 404 /index.html; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
"dependencies": { | ||
"@emotion/react": "^11.11.1", | ||
"@emotion/styled": "^11.11.0", | ||
"@g-loot/react-tournament-brackets": "^1.0.30", | ||
"@mui/icons-material": "^5.14.18", | ||
"@mui/material": "^5.14.18", | ||
"@types/jest": "^29.5.8", | ||
|
@@ -17,7 +16,9 @@ | |
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-router-dom": "^6.19.0", | ||
"styled-components": "^6.1.1", | ||
"react-svg-pan-zoom": "^3.13.1", | ||
"react-tournament-brackets": "^1.0.40", | ||
"styled-components": "^6.1.14", | ||
"typescript": "^5.2.2", | ||
"web-vitals": "^2.1.4" | ||
}, | ||
|
@@ -42,5 +43,10 @@ | |
"prettier": "^3.1.0", | ||
"vite": "^5.0.0" | ||
}, | ||
"packageManager": "[email protected]" | ||
"packageManager": "[email protected]", | ||
"overrides": { | ||
"react-tournament-brackets": { | ||
"styled-components": "$styled-components" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe I had to bump There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, seems to be a version mismatch in the devdependencies not the dependencies that matter. I might look into resolving this but it's fine. :) |
||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be deprecated.