From e8b330d1f87e70b2eae7a7cdbf6ee7420384f265 Mon Sep 17 00:00:00 2001 From: NivEz Date: Fri, 28 Jul 2023 20:18:02 +0300 Subject: [PATCH] added build pipeline --- .github/workflows/build.yaml | 30 ++++++++++++++++++++++++++++++ client/Dockerfile | 19 +++++++++++++++++++ client/package.json | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yaml create mode 100644 client/Dockerfile diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..2ce94f0 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,30 @@ +name: Build + +on: + push: + branches: [ main ] + +env: + DOCKER_USERNAME: nivezra + +jobs: + build-client: + runs-on: ubuntu-latest + env: + DOCKER_REPO: nivezra/super-bulb-client + steps: + # - name: Checkout + # uses: actions/checkout@v3 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ env.DOCKER_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Docker build and push + uses: docker/build-push-action@v4 + with: + context: "{{defaultContext}}:client" + push: true + tags: ${{ env.DOCKER_REPO}}:latest \ No newline at end of file diff --git a/client/Dockerfile b/client/Dockerfile new file mode 100644 index 0000000..1e809a4 --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,19 @@ +FROM node:latest as builder + +WORKDIR /app +COPY package.json /app/ +COPY yarn.lock /app/ + +RUN yarn install --immutable + +RUN ls -la + +COPY client /app/ +RUN yarn build + +FROM nginx:latest +COPY --from=builder /app/dist/ /usr/share/nginx/html + +EXPOSE 80 + +ENTRYPOINT ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/client/package.json b/client/package.json index 965aeb2..28e98a3 100644 --- a/client/package.json +++ b/client/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "vite --port 3000", + "dev": "vite --port 8080", "build": "vite build", "lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview"