Skip to content

Commit

Permalink
fix(ci): update dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihoub2 committed Sep 17, 2024
1 parent 28047fa commit 6de7a32
Show file tree
Hide file tree
Showing 5 changed files with 6,493 additions and 12,270 deletions.
24 changes: 7 additions & 17 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- staging

env:
DEPLOYMENT: ticket-office
DEPLOYMENT_NAMESPACE: ticket-office
Expand All @@ -20,29 +21,18 @@ jobs:
- name: 🔑 Login Docker
run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}

- name: Build client (Vite.js)
run: |
npm ci
cd client
npm run build --emptyOutDir --outDir './server/public'
- name: Build server (Bun)
- name: Build and push Docker image
run: |
cd server
bun install
docker build -t ${{ github.repository }} .
- name: Get Tag
id: version
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: 📦 Push Docker image
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
docker tag ${{ github.repository }} $IMAGE_ID:staging
docker push $IMAGE_ID:staging
- name: Get Tag
id: version
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

deploy:
name: 💭 Update staging deployment
runs-on: ubuntu-latest
Expand All @@ -65,7 +55,7 @@ jobs:
steps:
- uses: dataesr/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN}}
github_token: ${{ secrets.GITHUB_TOKEN }}
mattermost_webhook_url: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
mattermost_channel: ${{ env.MM_NOTIFICATION_CHANNEL }}
deployment_url: ${{ env.DEPLOYMENT_URL }}
17 changes: 12 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
FROM oven/bun
FROM oven/bun AS builder

WORKDIR /app

COPY ./server/package.json .
COPY ./client/package.json ./client/package-lock.json ./client/
RUN cd client && npm ci

COPY ./client ./client
RUN cd client && npm run build --emptyOutDir --outDir '../server/public'

COPY ./server/package.json ./server/
RUN bun i --production
COPY ./server .
COPY ./server ./server

ENV NODE_ENV=production
CMD ["bun", "run", "index.ts"]

EXPOSE 3000
EXPOSE 3000

CMD ["bun", "run", "server/index.ts"]
4 changes: 1 addition & 3 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-query-devtools": "^4.29.6",
"@types/react-select": "^5.0.1",
"classnames": "^2.3.2",
"highcharts": "^11.4.1",
"highcharts-react-official": "^3.2.1",
"prop-types": "^15.8.1",
Expand All @@ -29,7 +28,6 @@
"react-select": "^5.8.0",
"react-spinners": "^0.13.8",
"react-toastify": "^10.0.5",
"sib-api-v3-sdk": "^8.5.0",
"xlsx": "^0.18.5"
},
"devDependencies": {
Expand All @@ -49,4 +47,4 @@
"typescript": "^5.2.2",
"vite": "^5.0.4"
}
}
}
Loading

0 comments on commit 6de7a32

Please sign in to comment.