Skip to content

Commit

Permalink
Create ci/cd for vite dev environment
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyjuareza committed Mar 12, 2024
1 parent 05ae319 commit ffef220
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 115 deletions.
2 changes: 2 additions & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.npm
3 changes: 2 additions & 1 deletion frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
frontend/static
frontend/templates
node_modules
node_modules
dist/
29 changes: 29 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# syntax=docker/dockerfile:1

FROM node:20.11.1-bullseye AS build

# # Specify working directory other than /
WORKDIR /usr/src/app

# # Copy only files required to install
# # dependencies (better layer caching)
COPY package*.json ./

# # Use cache mount to speed up install of existing dependencies
RUN --mount=type=cache,target=/usr/src/app/.npm \
npm set cache /usr/src/app/.npm && \
npm install

COPY . .

RUN npm run build

# # Use separate stage for deployable image
FROM nginxinc/nginx-unprivileged:1.23-alpine-perl

# # Use COPY --link to avoid breaking cache if we change the second stage base image
COPY --link nginx.conf /etc/nginx/conf.d/default.conf

COPY --link --from=build usr/src/app/dist/ /usr/share/nginx/html

EXPOSE 8080
1 change: 0 additions & 1 deletion frontend/dist/assets/QualifierComponents-5WGFz71t.js

This file was deleted.

1 change: 0 additions & 1 deletion frontend/dist/assets/QualifierPageCalendar-rk_-nAza.js

This file was deleted.

1 change: 0 additions & 1 deletion frontend/dist/assets/QualifierPageRoles-gCbCKaDL.js

This file was deleted.

108 changes: 0 additions & 108 deletions frontend/dist/assets/index-VfS-tgyG.js

This file was deleted.

1 change: 0 additions & 1 deletion frontend/dist/assets/index-pWwPImNM.css

This file was deleted.

20 changes: 20 additions & 0 deletions frontend/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
server {
listen 8080;

# Docker internal dns server
resolver 127.0.0.11;

location /ping {
access_log off;
add_header 'Content-Type' 'text/plain';
return 200 "pong";
}

location / {
root /usr/share/nginx/html;
index src/templates/vite-index.html;
try_files $uri $uri/ src/templates/vite-index.html;
}

include /etc/nginx/extra-conf.d/*.conf;
}
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"main": "webpack.config.js",
"scripts": {
"watch": "webpack --mode development --watch",
"build": "webpack --mode production --output-path ./static",
"vbuild": "webpack --mode production --output-path ./static",
"test": "jest --config ./jest.config.js --testPathPattern=tests/ --maxWorkers=2",
"test:w": "jest --config ./jest.config.js --watchAll --testPathPattern=tests/",
"dev": "vite",
"vbuild": "vite build"
"build": "vite build"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit ffef220

Please sign in to comment.