Skip to content

Commit

Permalink
first working version
Browse files Browse the repository at this point in the history
  • Loading branch information
sxflynn committed Nov 11, 2023
1 parent fbc1fe9 commit 19a73cf
Show file tree
Hide file tree
Showing 18 changed files with 4,232 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
node_modules
20 changes: 20 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

#Environment variable
.env
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Use Alpine-based Node image
FROM node:alpine

# Set the working directory
WORKDIR /srv/app

# Install dependencies (You're already in /srv/app)
COPY package.json package-lock.json ./
RUN npm install --silent

# Copy the rest of the code (assuming .dockerignore handles unwanted files)
COPY . .

# Expose the port (default for Vite is 5173)
EXPOSE 5173

# Command to run your application
CMD ["npm", "run", "dev"]
26 changes: 26 additions & 0 deletions DockerfileProd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Use Alpine-based Node image (consider pinning to a specific version)
FROM node:alpine

# Set the working directory
WORKDIR /srv/app

# Install dependencies (You're already in /srv/app)
COPY package.json package-lock.json ./
RUN npm install --silent

# Copy the rest of the code (assuming .dockerignore handles unwanted files)
COPY . .

# Build the production assets
RUN npm run build

# Cleanup unnecessary files and install only production dependencies
RUN rm -rf node_modules && \
npm install --production --silent && \
npm install -g serve

# Expose the port (default for serve is 5173, but you can configure this)
EXPOSE 5173

# Command to serve your production assets
CMD ["serve", "-s", "dist", "-l", "0.0.0.0:5173"]
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# ihazinternetquestionmark
A simple web app that pings the internet and notifies you if your internet is down.
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
19 changes: 19 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3.8'
services:
react-frontend:
build:
dockerfile: ./Dockerfile
ports:
- "5173:5173"
volumes:
- ./:/srv/app
- node_modules:/srv/app/node_modules
networks:
- ihazinternet-network

volumes:
node_modules:

networks:
ihazinternet-network:
driver: bridge
22 changes: 22 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-5EV11E28HF"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-5EV11E28HF');
</script>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/internet-svgrepo-com.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>I Haz Internet?</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading

0 comments on commit 19a73cf

Please sign in to comment.