diff --git a/.actrc b/.actrc index 9ce4b22..90fbc55 100644 --- a/.actrc +++ b/.actrc @@ -1,6 +1,7 @@ ---privileged +--container-options --privileged --container-daemon-socket /run/user/1000/podman/podman.sock +--pull=false +--artifact-server-path act/artifact -P ubuntu-latest=localhost/act --env CONTAINER_REGISTRY=nextlab.hwangsehyun.com:41443 --s GITHUB_TOKEN -e act/pull-target.json \ No newline at end of file diff --git a/.github/workflows/express-ghcr.yml b/.github/workflows/express-ghcr.yml new file mode 100644 index 0000000..67fd739 --- /dev/null +++ b/.github/workflows/express-ghcr.yml @@ -0,0 +1,64 @@ +name: Build and push express to GHCR + + +on: + push: + branches-ignore: + - wip/* + paths: + - express/** + + workflow_call: + inputs: + service-name: + default: stream + type: string + tag: + required: true + type: string + outputs: + stream-image: + value: ${{ jobs.build-push-ghcr.outputs.stream-image }} + + +jobs: + build-push-ghcr: + name: Build and push to GHCR + runs-on: ubuntu-latest + env: + TAG: ${{ github.ref_name || inputs.tag }} + + permissions: + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: docker compose config + id: docker-compose-config + run: > + echo -n stream-image= >> "$GITHUB_OUTPUT" + && docker compose config --format json | jq .services.stream.image >> "$GITHUB_OUTPUT" + shell: sh + + - name: Build a container + run: docker compose build ${{ inputs.service-name || 'express' }} + shell: sh + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - if: ${{ !env.ACT }} + name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push a container to GHCR + run: docker compose push ${{ inputs.service-name || 'express'}} + shell: sh + + outputs: + stream-image: ${{ steps.docker-compose-config.outputs.stream-image }} diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml deleted file mode 100644 index e993008..0000000 --- a/.github/workflows/ghcr.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Push to GHCR -on: - push: - branches-ignore: - - wip/* - -env: - TAG: ${{ github.ref_name }} - -jobs: - push-ghcr: - name: Build and push image to GHCR - runs-on: ubuntu-latest - if: ${{ !contains(github.event.pull_request_target.merged, false) }} - - steps: - - name: Echo inputs - run: env; echo $TAG - shell: sh - - - name: Checkout - uses: actions/checkout@v2 - - - name: Build containers - run: docker-compose build - shell: sh - - - name: Login to GHCR - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Push containers to GHCR - run: docker-compose push - shell: sh \ No newline at end of file diff --git a/.github/workflows/nginx-ghcr-pages.yml b/.github/workflows/nginx-ghcr-pages.yml new file mode 100644 index 0000000..b855e9e --- /dev/null +++ b/.github/workflows/nginx-ghcr-pages.yml @@ -0,0 +1,59 @@ +name: Build and push nginx to GHCR, Deploy to Pages + + +on: + push: + branches-ignore: + - wip/* + paths: + - nginx/** + +jobs: + build-push-ghcr: + uses: ./.github/workflows/express-ghcr.yml + with: + tag: ${{ github.ref_name }} + + deploy-pages: + needs: build-push-ghcr + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + + permissions: + contents: read + pages: write + id-token: write + + steps: + - name: Export static files + run: docker cp $(docker create ${{ needs.build-push-ghcr.outputs.stream-image }}):/var/www/html /tmp/pages + shell: sh + + - name: Set API URLs + working-directory: /tmp/pages + run: > + sed -i 's;\n + + diff --git a/nginx/misc.js b/nginx/misc.js index 698d372..78b4d0a 100644 --- a/nginx/misc.js +++ b/nginx/misc.js @@ -1,5 +1,5 @@ -const PUB_URL = window.PUB_URL || 'http://localhost:8080'; -export const SUB_URL = window.SUB_URL || 'ws://localhost:8000/ws/imshow'; +const PUB_URL = window.PUB_URL || 'http://localhost:8889'; +export const SUB_URL = window.SUB_URL || 'ws://localhost:8888/ws/imshow'; const img = document.querySelector('#initial'); const mousePositionElement = document.querySelector('#mouse-position');