Skip to content

Commit

Permalink
Set api url for fly.io
Browse files Browse the repository at this point in the history
  • Loading branch information
sehyun-hwang committed Aug 9, 2023
1 parent 820808d commit 4e46cb4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/express-ghcr.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Build and push express to GHCR


on:
push:
branches-ignore:
Expand All @@ -16,6 +17,7 @@ on:
stream-image:
value: ${{ jobs.build-push-ghcr.outputs.stream-image }}


jobs:
build-push-ghcr:
name: Build and push to GHCR
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/nginx-ghcr-pages.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Build and push nginx to GHCR, Deploy to Pages


on:
push:
branches-ignore:
- wip/*



jobs:
build-push-ghcr:
uses: ./.github/workflows/express-ghcr.yml
Expand All @@ -26,18 +27,30 @@ jobs:

steps:
- name: Export static files
run: docker cp $(docker create ghcr.io/sehyun-hwang/imshow-nginx):/var/www/html /tmp/pages
shell: sh

- name: Set API URLs
working-directory: /tmp/pages
run: >
mkdir -p nginx/pages
&& docker cp $(docker create ${{ needs.build-push-ghcr.outputs.stream-image }}):/var/www/html nginx/pages
sed -i 's;<script src="./index.js";
<script>\n
var PUB_URL = "https://imshow-express.fly.dev"\;\n
var SUB_URL = "https://imshow-nginx.fly.dev/ws/imshow"\n
</script>\n
<script src="./index.js";'
index.html
shell: sh

- if: ${{ !env.ACT }}
name: Setup Pages
uses: actions/configure-pages@v3

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: nginx/pages
path: /tmp/pages

- if: ${{ !env.ACT }}
name: Deploy Pages
id: deployment
Expand Down
5 changes: 2 additions & 3 deletions nginx/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_modules
node_modules/
dist.js

Dockerfile
eslint.config.js
4 changes: 2 additions & 2 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ WORKDIR /mnt
COPY package.json ./
RUN yarn

COPY esbuild ./esbuild
COPY esbuild esbuild
RUN yarn build

FROM shurco/nginx-push-stream-module

COPY . /var/www/html
COPY index.html *.js /var/www/html/
COPY --from=build /mnt/esbuild/dist.js /var/www/html/esbuild/dist.js

LABEL org.opencontainers.image.source https://github.com/sehyun-hwang/imshow
2 changes: 1 addition & 1 deletion nginx/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
display: inline;
}
</style>
<script type="module" src="./index.js"></script>
<script src="./index.js" type="module"></script>
</head>

<body>
Expand Down

0 comments on commit 4e46cb4

Please sign in to comment.