From 938f8f29b1b4510949136d8790846344488c344a Mon Sep 17 00:00:00 2001 From: DimonBor Date: Wed, 17 Apr 2024 17:02:50 +0300 Subject: [PATCH] Add prod workflow --- .github/workflows/docker-publish-demo.yml | 43 +++++++++++++++++++++++ Dockerfile | 4 +-- Dockerfile-demo | 16 +++++++++ 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docker-publish-demo.yml create mode 100644 Dockerfile-demo diff --git a/.github/workflows/docker-publish-demo.yml b/.github/workflows/docker-publish-demo.yml new file mode 100644 index 0000000..f9d15b8 --- /dev/null +++ b/.github/workflows/docker-publish-demo.yml @@ -0,0 +1,43 @@ +name: Tres to Docker (Demo) + +on: + push: + branches: + - dev + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + file: ./Dockerfile-demo + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 1de82dc..c5f17ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM node:18.16.0-alpine as tres-build-base -ENV VITE_API_URL="https://burrito.tres.cyberbydlo.com" -ENV VITE_WS_URL="wss://burrito.tres.cyberbydlo.com/ws" +ENV VITE_API_URL="https://tres.sumdu.edu.ua/api" +ENV VITE_WS_URL="wss://https://tres.sumdu.edu.ua/api/ws" WORKDIR /app COPY . /app diff --git a/Dockerfile-demo b/Dockerfile-demo new file mode 100644 index 0000000..1de82dc --- /dev/null +++ b/Dockerfile-demo @@ -0,0 +1,16 @@ +FROM node:18.16.0-alpine as tres-build-base + +ENV VITE_API_URL="https://burrito.tres.cyberbydlo.com" +ENV VITE_WS_URL="wss://burrito.tres.cyberbydlo.com/ws" + +WORKDIR /app +COPY . /app +RUN npm config delete proxy +RUN npm install +RUN npm run build + +FROM nginx:latest + +COPY --from=tres-build-base /app/dist /usr/share/nginx/html +COPY ./etc/www/tres.svg /usr/share/nginx/html/tres.svg +COPY ./etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf