Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
675216c
mitigate babel errors
RafaelCenzano Apr 26, 2025
08a5c2f
Convert to vite
RafaelCenzano Apr 27, 2025
96069bd
update packages to support vite over CRA
RafaelCenzano Apr 27, 2025
7546f64
configure postcss
RafaelCenzano Apr 27, 2025
a3c7c26
create updated index.html for vite
RafaelCenzano Apr 27, 2025
6f891b8
rename to jsx files
RafaelCenzano Apr 27, 2025
2bebebd
conver to vite compatible main.tsx
RafaelCenzano Apr 27, 2025
5fb8576
minor updates to App.tsx
RafaelCenzano Apr 27, 2025
9add011
eslint config
RafaelCenzano Apr 27, 2025
c35ca0b
update eslint github action
RafaelCenzano Apr 27, 2025
5f52610
clean up dependencies removing old create react app things
RafaelCenzano Apr 27, 2025
d6f504e
uneeded file
RafaelCenzano Apr 27, 2025
51b6ff9
hide vite build file "dist"
RafaelCenzano Apr 27, 2025
8c5a2e7
Update Dockerfile to support Vite
RafaelCenzano Apr 27, 2025
c397cd4
use health route
RafaelCenzano Apr 27, 2025
1beb882
remove uneeded dependencies that were deprecated/depended on deprecat…
RafaelCenzano Apr 27, 2025
9aec5c6
Remove uneeded dependencies
RafaelCenzano Apr 27, 2025
f6516c5
Update typescript, remove the need for PR #116
RafaelCenzano Apr 27, 2025
0de8eef
update tailwindcss remove the need for #126
RafaelCenzano Apr 28, 2025
b091087
upgrade packages
RafaelCenzano May 1, 2025
108a1a4
Merge branch 'main' into fix-deps
RafaelCenzano May 1, 2025
6bb1b6a
Changed to update to vite and tailwindcss:
RafaelCenzano May 1, 2025
d23c4ef
complete upgrade using npx tailwind upgrade utility
RafaelCenzano May 1, 2025
08d48cd
Fix linting
RafaelCenzano May 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Lint
on:
pull_request:
paths:
- "**.js"
- "**.jsx"
- "**.ts"
- "**.tsx"
- "src/**/*.js"
- "src/**/*.jsx"
- "src/**/*.ts"
- "src/**/*.tsx"

jobs:
eslint:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.DS_Store
node_modules
build
dist
.env
.vscode
41 changes: 20 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
FROM node:23-alpine3.21 AS base

# Install dependencies
FROM base AS deps
# Build stage
FROM node:22-alpine3.21 AS builder

WORKDIR /app

# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
# Install libc6-compat if needed
RUN apk add --no-cache libc6-compat

# Install dependencies
COPY package.json package-lock.json ./

RUN npm ci

# Build the app with the node modules installed
FROM base AS builder

WORKDIR /app

COPY --from=deps /app/node_modules ./node_modules
# Build the Vite app
COPY . .

RUN npm run build

# Create a new image with the build files
FROM base AS runner
# Final stage: nginx serving dist/
FROM nginx:stable-alpine as runner

WORKDIR /app
# Remove default nginx website
RUN rm -rf /usr/share/nginx/html/*

# Copy custom nginx config
COPY nginx.conf /etc/nginx/nginx.conf

COPY --from=builder /app/build ./build
RUN npm install -g serve
# Copy built Vite files
COPY --from=builder /app/dist /usr/share/nginx/html

# Healthcheck for nginx
HEALTHCHECK --interval=10s --timeout=5s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://0.0.0.0:3000/health || exit 1
CMD wget --no-verbose --tries=1 --spider http://0.0.0.0/health || exit 1

EXPOSE 3000
# Expose port 80 (standard HTTP)
EXPOSE 80

CMD ["serve", "-s", "build"]
# Start nginx automatically
CMD ["nginx", "-g", "daemon off;"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
develop:
npm start
npm run dev

build:
npm run build
Expand All @@ -13,7 +13,7 @@ docker-build: build
docker push enchanter77/labconnect-frontend

lint:
eslint --max-warnings=0 'src/**/*{js,jsx,ts,tsx}'
npm run lint

lintfix:
eslint --max-warnings=0 'src/**/*{js,jsx,ts,tsx}' --fix
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Labconnect</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
27 changes: 27 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
worker_processes 1;

events { worker_connections 1024; }

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;

server {
listen 80;

server_name _;

root /usr/share/nginx/html;
index index.html;

location / {
try_files $uri $uri/ /index.html;
}

# Enable gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
}
}
Loading