diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 92d4d64..86a7cc3 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -15,23 +15,34 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 + - uses: oven-sh/setup-bun@v2 - name: 🔑 Login Docker run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} - - name: 🐳 Build Docker image + - name: Build client (Vite.js) run: | - IMAGE_ID=ghcr.io/${{ github.repository }} - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - docker build -t $IMAGE_ID:staging . + npm i --prefix client + npm run build --prefix client + + - name: Move client build to server + run: mv client/dist/* server/public/ + + - name: Build server (Bun) + 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 deploy: diff --git a/Dockerfile b/Dockerfile index c5df6b5..9fc42b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,12 @@ -FROM node:18-alpine AS build +FROM oven/bun + WORKDIR /app -COPY package*.json ./ -RUN npm ci --silent -COPY . . -RUN npm run build - -FROM nginx:stable -COPY nginx.conf /etc/nginx/conf.d/default.conf -EXPOSE 5173 \ No newline at end of file + +COPY ./server/package.json . +RUN bun i --production +COPY ./server . + +ENV NODE_ENV=production +CMD ["bun", "run", "index.ts"] + +EXPOSE 3000 \ No newline at end of file diff --git a/index.html b/client/index.html similarity index 86% rename from index.html rename to client/index.html index 79fea77..c299c94 100644 --- a/index.html +++ b/client/index.html @@ -13,6 +13,6 @@
- +