diff --git a/.github/workflows/TestCI.yml b/.github/workflows/TestCI.yml index 2d8a78d..7266d9d 100644 --- a/.github/workflows/TestCI.yml +++ b/.github/workflows/TestCI.yml @@ -1,13 +1,10 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - name: youtube-stats Actions CI on: push: - branches: [ "master" ] + branches: [ "CIbranch" ] pull_request: - branches: [ "master" ] + branches: [ "CIbranch" ] jobs: build: @@ -16,9 +13,30 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 16 uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node-version }} + node-version: 16 cache: 'npm' + - name: Install react-scripts + run: npm install react-scripts + - name: Add node_modules to PATH + run: echo "export PATH=$PATH:$HOME/node_modules" >> ~/.bashrc - run: npm run build --if-present + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v4 + with: + push: true + tags: knowlegepot/examplereactapp:latest + + + + diff --git a/.travis.yml b/.travis.yml index 3ac2d45..2dad070 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ language: node_js +node_js: + - 12 services: - docker before_install: - - docker build -t kowledgepot/reactapp -f Dockerfile.dev . - -script: - - docker run kowledgepot/reactapp npm run test -- --coverage + - docker build -t reactapp -f Dockerfile . - +script: + - docker run reactapp npm run test -- --coverage diff --git a/Dockerfile b/Dockerfile index a586757..1ae25cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,11 @@ -FROM node:latest - +FROM node:16 RUN mkdir -p /app/src - WORKDIR /app/src - COPY package.json . - +RUN npm cache clean --force RUN npm install - COPY . . - EXPOSE 3000 - CMD ["npm", "start"] +