Skip to content

fix: Dockerfile to reduce vulnerabilities #147

fix: Dockerfile to reduce vulnerabilities

fix: Dockerfile to reduce vulnerabilities #147

Workflow file for this run

name: CI
on: [push, pull_request]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_CLIENT_ID }}
AWS_DEFAULT_REGION: 'eu-west-1'
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_CLIENT_SECRET }}
NDLA_AWS_ECR_REPO: ${{ secrets.NDLA_AWS_ECR_REPO }}
CI_RELEASE_ROLE: ${{ secrets.CI_RELEASE_ROLE }}
CI_GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
NDLA_RELEASES: ${{ secrets.NDLA_RELEASES }}
PACT_BROKER_PASSWORD: ${{ secrets.PACT_BROKER_PASSWORD }}
PACT_BROKER_URL: ${{ secrets.PACT_BROKER_URL }}
PACT_BROKER_USERNAME: ${{ secrets.PACT_BROKER_USERNAME }}
jobs:
unit_tests:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20.9'
- name: 'Login to ECR repo'
run:
RES=$(aws sts assume-role --role-arn $CI_RELEASE_ROLE --role-session-name github-actions-ecr-login)
AWS_ACCESS_KEY_ID=$(echo $RES | jq -r .Credentials.AccessKeyId)
AWS_SECRET_ACCESS_KEY=$(echo $RES | jq -r .Credentials.SecretAccessKey)
AWS_SESSION_TOKEN=$(echo $RES | jq -r .Credentials.SessionToken)
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin $NDLA_AWS_ECR_REPO
- name: Login to dockerhub
run: echo $DOCKER_HUB_PASSWORD | docker login --username $DOCKER_HUB_USERNAME --password-stdin
- name: Install
run: npm install
- name: Linting
run: npm run lint
- name: Unit tests
run: npm test