diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac0bb05..80e50dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: Build and Push via Master on: push: branches: - - master + - fe-v0.1.2 tags: - '*' @@ -41,13 +41,14 @@ jobs: run: docker push ${{ steps.image.outputs.name }} frontend_test_build_and_push_to_docker_registry: - name: build and publish frontend image to docker hub + name: Test, build and publish frontend image to docker hub runs-on: ubuntu-latest steps: - uses: actions/checkout@master - uses: actions/setup-node@v3 with: node-version: '18.x' + - name: Docker login env: DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} @@ -65,5 +66,20 @@ jobs: - name: Docker build and tag image run: cd frontend && docker build . --file Dockerfile --tag ${{ steps.image.outputs.name }} + - name: Install dependencies #test after docker build to not pollute image with files + run: cd frontend && yarn + # env: + # NODE_ENV: production + + - name: Test build + run: cd frontend && yarn run build + # env: + # NODE_ENV: production + + - name: Test serve + run: cd frontend && yarn global add serve + # env: + # NODE_ENV: production + - name: Docker push run: docker push ${{ steps.image.outputs.name }} diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 14d0114..5ad1f6b 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,17 +1,11 @@ -FROM node:18-alpine -ENV NODE_ENV=production +FROM node:18 -RUN npm install -g yarn --force +# ENV NODE_ENV=production #breaks COPY . ./app WORKDIR /app -#macos -RUN apk add --update --no-cache python3 g++ make - -RUN yarn install - -EXPOSE 5000 +RUN yarn CMD ["/bin/sh","-c","/app/start.sh"] \ No newline at end of file