diff --git a/.env.testing b/.env.testing:dev similarity index 100% rename from .env.testing rename to .env.testing:dev diff --git a/.env.testing:prod b/.env.testing:prod new file mode 100644 index 00000000..c4ebc3a9 --- /dev/null +++ b/.env.testing:prod @@ -0,0 +1,2 @@ +VITE_PROTOCOL=http +VITE_HOST=balancer diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d93289f7..4c5243ab 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -64,6 +64,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + packages: read steps: - name: ๐Ÿ“ฅ Checkout @@ -85,9 +86,8 @@ jobs: tags: shlokas:latest outputs: type=docker,dest=/tmp/shlokas-container.tar build-args: | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ENVIRONMENT: testing - + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + ENVIRONMENT=testing - name: ๐Ÿณ Upload artifact uses: actions/upload-artifact@v3.1.2 @@ -120,19 +120,16 @@ jobs: - name: ๐Ÿณ Load Docker image run: | docker load --input /tmp/shlokas-container.tar - docker image ls -a - # - name: Environment - # uses: isbang/compose-action@v1.4.1 - # with: - # compose-file: | - # docker-compose.yml - # docker-compose.testing.yml - # docker-compose.testing.ci.yml - # down-flags: "--volumes" + - name: ๐Ÿณ Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: ๐Ÿณ Start server - run: ./shlokas.run.sh testing + run: docker login --username=${{ github.actor }} --password=${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }} && ./shlokas.run.sh testing shell: bash - name: ๐Ÿงช Testing diff --git a/Dockerfile b/Dockerfile index 519af61d..c9a57c0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,12 +8,13 @@ FROM node:19.8.1-alpine3.17 AS build ARG GITHUB_TOKEN ARG ENVIRONMENT=prod +ENV GITHUB_TOKEN=${GITHUB_TOKEN} # -------------------- Install and cache app dependencies -------------------- # WORKDIR /app COPY package.json package-lock.json .npmrc ./ -RUN GITHUB_TOKEN=${GITHUB_TOKEN} npm ci +RUN npm ci # --------------------------------- Build app -------------------------------- #