diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d84582..c30eb6a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Succeeds on PR +name: Building on: pull_request: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..a2ecdb3 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,32 @@ +name: Deploy Image + +on: + workflow_run: + workflows: ["Building"] + types: + - completed + +jobs: + build-and-push: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + steps: + - name: check-out repository + uses: actions/checkout@v4 + + - name: log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{secrets.DOCKER_USERNAME}} + password: ${{secrets.DOCKER_PASSWORD}} + + - name: Build and Push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: adil56/myuni-student:latest + + - name: Verify Push image + run: docker pull adil56/myuni-student:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..996a648 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM node:20-slim + +RUN apt-get update -y && apt-get install -y openssl && rm -rf /var/lib/apt/lists/* + +WORKDIR /src + +COPY package*.json ./ +RUN npm install + +COPY . . + +RUN npm run build + +EXPOSE 5173 + +CMD ["npm", "run", "start"] \ No newline at end of file