diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..bf2f4fc --- /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: ./client + push: true + tags: $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"