From a6b5da82b60f627ddf4b8d7470e2d11cb86ffd99 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 | 17 +++++++++++++++++ client/package.json | 2 +- 3 files changed, 48 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..138913a --- /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: ${{ env.DOCKER_USERNAME}}/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: ./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..b3f0326 --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,17 @@ +FROM node:latest as builder + +WORKDIR /app +COPY package.json /app/ +COPY yarn.lock /app/ + +RUN yarn install --immutable + +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"