This repository has been archived by the owner on Oct 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We've been hosting the dapp as a static website, but the developers have maintained it as a single-page application (SPA). Let's update the containerfile to handle hosting the app so we can deploy via container image.
- Loading branch information
Showing
6 changed files
with
75 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
name: Build container image | ||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- '**' | ||
jobs: | ||
build-and-push-penumbra: | ||
runs-on: buildjet-16vcpu-ubuntu-2004 | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Docker Hub container registry (for pulls) | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Log in to the GitHub container registry (for pushes) | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/penumbra-zone/dapp | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
file: Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
FROM node:16 | ||
|
||
ENV PORT 9012 | ||
FROM node:16 AS builder | ||
|
||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
|
||
COPY package*.json /usr/src/app/ | ||
RUN npm config set @buf:registry https://buf.build/gen/npm/v1/ | ||
RUN npm install | ||
|
||
COPY . /usr/src/app | ||
RUN npm run build | ||
|
||
# Install a static webserver, to emulate Firebase static website hosting. | ||
RUN npm install http-server -g | ||
WORKDIR /usr/src/app/build | ||
EXPOSE 9012 | ||
# CMD [ "npm", "start" ] | ||
CMD [ "http-server" ] | ||
EXPOSE 8080 | ||
|
||
# Not using a custom "prod" script from package.json, | ||
# due to routing problems. | ||
# CMD [ "npm", "run", "start:prod" ] | ||
CMD [ "npm", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
build: | ||
./build-static-site | ||
container: | ||
docker build -t penumbra_dapp . | ||
docker run -p 9012:9012 -it penumbra_dapp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters