0
0
Expressframework~10 mins

CI/CD pipeline for Express apps - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to install dependencies in a GitHub Actions workflow for an Express app.

Express
steps:
  - uses: actions/checkout@v3
  - name: Install dependencies
    run: npm [1]
Drag options to blanks, or click blank then click option'
Ainstall
Bstart
Ctest
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'npm start' instead of 'npm install' will try to run the app, not install packages.
2fill in blank
medium

Complete the code to run tests in the GitHub Actions workflow.

Express
steps:
  - name: Run tests
    run: npm [1]
Drag options to blanks, or click blank then click option'
Abuild
Btest
Cinstall
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'npm start' runs the app instead of tests.
3fill in blank
hard

Fix the error in the deployment step to push the Docker image to Docker Hub.

Express
steps:
  - name: Log in to Docker Hub
    uses: docker/login-action@v2
    with:
      username: ${{ secrets.DOCKER_USERNAME }}
      password: ${{ secrets.DOCKER_PASSWORD }}
  - name: Build and push Docker image
    run: |
      docker build -t myapp:[1] .
      docker push myapp:[1]
Drag options to blanks, or click blank then click option'
Alatest
Bbuild
Cversion
Ddeploy
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'build' or 'version' as tag names may cause errors if those tags don't exist.
4fill in blank
hard

Fill both blanks to create a GitHub Actions job that triggers on push to the main branch and sets up Node.js.

Express
on:
  push:
    branches: [[1]]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: [2]
Drag options to blanks, or click blank then click option'
A"main"
B"develop"
C"18"
D"16"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'develop' branch or older Node.js versions may not match the project setup.
5fill in blank
hard

Fill all three blanks to define a Dockerfile that uses Node.js 18, copies app files, and runs the app.

Express
FROM node:[1]
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY [2] ./
CMD ["node", "src/[3]"]
Drag options to blanks, or click blank then click option'
A18
Bsrc
Cindex.js
D16
Attempts:
3 left
💡 Hint
Common Mistakes
Using Node.js 16 when the project requires 18, or copying wrong folders, or wrong start file name.