From 5150ea7284c1a4686a8bfb347236f8e3e28c28ec Mon Sep 17 00:00:00 2001 From: RcleydsonR Date: Mon, 24 Oct 2022 21:32:58 -0300 Subject: [PATCH 1/5] chore: docker config --- Dockerfile | 10 ++++++++++ docker-compose.yml | 11 +++++++++++ 2 files changed, 21 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..02ab85e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM node:lts-alpine + +WORKDIR /app + +COPY package*.json ./ +RUN npm install +COPY ./ ./ + +EXPOSE 3000 +CMD ["npm", "run", "start"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..98a1783 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3.8' + +services: + p2pix: + container_name: p2pix_frontend + build: + context: . + volumes: + - '.:/app' + ports: + - '3000:3000' \ No newline at end of file From a721c72935052cb8ed4a77cdddc4f76b2cc37825 Mon Sep 17 00:00:00 2001 From: RcleydsonR Date: Mon, 24 Oct 2022 21:33:07 -0300 Subject: [PATCH 2/5] chore: deploy script --- .github/workflows/cd.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..a06b080 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,27 @@ +name: Deploy FrontEnd + +on: + push: + branches: [ main ] + +jobs: + deploy-frontend: + runs-on: ubuntu-latest + steps: + - name: 🏗 Setup repo + uses: actions/checkout@v3 + + - name: 🏗 Setup node + uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: 'npm' + + - name: 🏗 Install dependencies + run: npm ci + + - name: 📦 Build app bundle + run: npm run build --if-present + + - name: 📦 Deploy to netlify + run: netlify deploy --auth ${{ secrets.NETLIFY_AUTH_TOKEN }} --site p2pix --prod \ No newline at end of file From a09a031e61b0403eb8064b1a466efef5c7030818 Mon Sep 17 00:00:00 2001 From: RcleydsonR Date: Mon, 24 Oct 2022 21:33:12 -0300 Subject: [PATCH 3/5] chore: ci script without tests --- .github/workflows/ci.yml | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c7adafd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI script + +on: push + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: 🏗 Setup repo + uses: actions/checkout@v3 + + - name: 🏗 Setup node + uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: 'npm' + + - name: 🏗 Install dependencies + run: npm ci + + - name: 📦 Lint with eslint + run: npm run lint + + build: + runs-on: ubuntu-latest + steps: + - name: 🏗 Setup repo + uses: actions/checkout@v3 + + - name: 📦 Build docker image + run: | + docker build -t p2pix:$GITHUB_SHA . + docker save -o image_$GITHUB_SHA p2pix:$GITHUB_SHA + + - name: 📦 Put docker image in cache + uses: actions/cache@v3 + with: + key: p2pix + path: image_${{ github.sha }} + + # test job \ No newline at end of file From 63c5669026ce26a2b15ad43a21f45715c4f20786 Mon Sep 17 00:00:00 2001 From: RcleydsonR Date: Mon, 24 Oct 2022 21:34:18 -0300 Subject: [PATCH 4/5] fix: lint error by adding node env in eslint config --- .eslintrc.cjs | 3 +++ package.json | 5 +++-- src/views/HomeView.vue | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index dc51c01..0b2a030 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -3,6 +3,9 @@ require("@rushstack/eslint-patch/modern-module-resolution"); module.exports = { root: true, + env: { + node: true, + }, extends: [ "plugin:vue/vue3-essential", "eslint:recommended", diff --git a/package.json b/package.json index 8490fb0..cb1e2d1 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,14 @@ "name": "p2pix-front-end", "version": "0.0.0", "scripts": { - "start": "vite", + "start": "vite --host=0.0.0.0 --port 3000", "build": "run-p type-check build-only", "preview": "vite preview", "serve": "vue-cli-service serve", "build-only": "vite build", "type-check": "vue-tsc --noEmit", - "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore" + "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", + "lint:fix": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore --fix" }, "dependencies": { "@headlessui/vue": "^1.7.3", diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index d5c0217..23a53cd 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -1,5 +1,5 @@