From 718c52b4971414c2df8ee500ad83d92c52aadbd4 Mon Sep 17 00:00:00 2001 From: jalal Date: Wed, 6 May 2026 14:15:17 +0200 Subject: [PATCH] add new files --- .dockerignore | 8 ++++++++ .ghaymah.json | 15 +++++++++++++++ .github/workflows/main.yaml | 19 +++++++++++++++++++ Dockerfile | 18 ++++++++++++++++++ nginx.conf | 16 ++++++++++++++++ 5 files changed, 76 insertions(+) create mode 100644 .dockerignore create mode 100644 .ghaymah.json create mode 100644 .github/workflows/main.yaml create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e3d2b5d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +node_modules +build +.git +.github +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.DS_Store diff --git a/.ghaymah.json b/.ghaymah.json new file mode 100644 index 0000000..b45ae7b --- /dev/null +++ b/.ghaymah.json @@ -0,0 +1,15 @@ +{ + "id": "722d126b-c573-40f1-a738-57002876780b", + "name": "cicdproject", + "projectId": "896ba892-9448-4061-97e7-b0506ccc3e3a", + "ports": [{ + "expose": true, + "number": 80 + }], + "publicAccess": { + "enabled": true, + "domain": "auto" + }, + "resourceTier": "t2", + "dockerFileName": "Dockerfile" +} \ No newline at end of file diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..5ba6860 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,19 @@ +on: + push: + pull_request: + +jobs: + deploy: + needs: build_and_push_image + steps: + - name: checkout code + uses: actions/checkout@v5.0.0 + - name: install ghaymah cli + run: curl -sSl https://cli.ghaymah.systems/install.sh | bash + + - name: login to ghaymah + run: $HOME/ghaymah/bin/gy auth login --email "${{secrets.GHAYMAH_EMAIL}}" --password "${{secrets.GHAYMAH_PW}}" + + - name: deploy + run: $HOME/ghaymah/bin/gy resource app launch + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1a0ab00 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM node:20-alpine AS build + +WORKDIR /app + +COPY package.json package-lock.json ./ +RUN npm ci + +COPY . . +RUN npm run build + +FROM nginx:1.27-alpine AS runtime + +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/build /usr/share/nginx/html + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..94c8f6c --- /dev/null +++ b/nginx.conf @@ -0,0 +1,16 @@ +server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location /static/ { + expires 1y; + add_header Cache-Control "public, immutable"; + } +}