Skip to content

Commit

Permalink
fix docker and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wanwiset25 committed Aug 23, 2023
1 parent 5729fa9 commit 1084984
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build and Push via Master
on:
push:
branches:
- master
- fe-v0.1.2
tags:
- '*'

Expand Down Expand Up @@ -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}}
Expand All @@ -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 }}
12 changes: 3 additions & 9 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit 1084984

Please sign in to comment.