Skip to content

Commit

Permalink
CD: move yarn build to image
Browse files Browse the repository at this point in the history
  • Loading branch information
jinho-choi123 committed Apr 26, 2024
1 parent 30760c6 commit 97faee3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
10 changes: 7 additions & 3 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ FROM node:18-alpine

WORKDIR /app

COPY ./dist/ /app/
COPY . .

RUN npm install --global serve
RUN yarn

RUN yarn build

RUN yarn global add serve

EXPOSE 80

ENTRYPOINT ["serve", "-l", "80", "/app"]
ENTRYPOINT ["serve", "-l", "80", "/app/dist"]
2 changes: 2 additions & 0 deletions .docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ services:
labels: [ "com.centurylinklabs.watchtower.scope=zabo-boards" ]
zabo-boards:
image: ghcr.io/sparcs-kaist/zabo-boards:latest
ports:
- 8888:80
labels: [ "com.centurylinklabs.watchtower.scope=zabo-boards" ]
13 changes: 2 additions & 11 deletions .github/workflows/prod-build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install Yarn
run: npm install --global yarn
- name: Install dependencies
run: yarn & yarn build
- name: Setup Docker buildX
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
Expand All @@ -29,8 +22,6 @@ jobs:
${{runner.os}}-buidx-
- name: Log in to Github Container Registry
run: echo ${{secrets.GITHUB_TOKEN}} | docker login ghcr.io -u USERNAME --password-stdin
- name: Build Static Content
run:
- name: Build and Push Image
id: docker-build
uses: docker/build-push-action@v5
Expand All @@ -40,8 +31,8 @@ jobs:
file: ./.docker/Dockerfile
push: true
tags: |
"ghcr.io/sparcs-kaist/zabo-server:${{ env.IMAGE_TAG }}"
"ghcr.io/sparcs-kaist/zabo-server:latest"
"ghcr.io/sparcs-kaist/zabo-boards:${{ env.IMAGE_TAG }}"
"ghcr.io/sparcs-kaist/zabo-boards:latest"
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Remove old cache
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"prod": "docker compose -p zabo-boards -f .docker/docker-compose.yaml",
"prod:up": "yarn prod up",
"prod:down": "yarn prod down",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"prettier": "prettier --write --config .prettierrc -u",
Expand Down

0 comments on commit 97faee3

Please sign in to comment.