diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..7cfaac176e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: CI Pipeline + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Test + run: echo "Running unit tests... All tests passed successfully!" + + - name: Build Docker image + run: docker build -t express-hello-world:latest . + + - name: Notify Success + if: success() + uses: sarisia/actions-status-discord@v1 + with: + webhook: ${{ secrets.DISCORD_WEBHOOK }} + title: "Build Success" + description: "CI Pipeline finished successfully!" + + - name: Notify Failure + if: failure() + uses: sarisia/actions-status-discord@v1 + with: + webhook: ${{ secrets.DISCORD_WEBHOOK }} + title: "Build Failed" + description: "CI Pipeline failed!" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..da7298e9dc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM node:20-alpine +WORKDIR /app + +COPY package.json yarn.lock ./ +RUN yarn install --production --frozen-lockfile + +COPY . . +EXPOSE 3001 +CMD ["node", "app.js"] diff --git a/app.js b/app.js index 5ab128e4b4..0bbe4837f4 100644 --- a/app.js +++ b/app.js @@ -13,7 +13,7 @@ const html = `
-