diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 8904d21..8bb74b1 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -4,7 +4,6 @@ on: push: branches: - staging - env: DEPLOYMENT: ticket-office DEPLOYMENT_NAMESPACE: ticket-office @@ -21,18 +20,29 @@ jobs: - name: 🔑 Login Docker run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} - - name: Build and push Docker image + - name: Build client (Vite.js) + run: | + npm ci + cd client + npm run build --emptyOutDir --outDir '../server/public' + + - name: Build server (Bun) run: | + cd server + bun install docker build -t ${{ github.repository }} . - 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 + - 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 + deploy: name: 💭 Update staging deployment runs-on: ubuntu-latest @@ -55,7 +65,7 @@ jobs: steps: - uses: dataesr/mm-notifier-action@v1.0.2 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 }} diff --git a/Dockerfile b/Dockerfile index d3bc1ff..9fc42b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,12 @@ -FROM oven/bun AS builder +FROM oven/bun WORKDIR /app -COPY ./client/package.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/ +COPY ./server/package.json . RUN bun i --production -COPY ./server ./server +COPY ./server . ENV NODE_ENV=production +CMD ["bun", "run", "index.ts"] -EXPOSE 3000 - -CMD ["bun", "run", "server/index.ts"] +EXPOSE 3000 \ No newline at end of file