Skip to content

Commit

Permalink
Adding GitHub workflows to generate container images (#235)
Browse files Browse the repository at this point in the history
* Adding GitHub workflows to generate container images for app

* Updating Flourish references to SparkHacks in README.

---------

Co-authored-by: Chase 李 <[email protected]>
  • Loading branch information
clee231 and Chase 李 authored Jan 15, 2024
1 parent c5c8b71 commit 9b7f3b7
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 3 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/container-build-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: Container Build Merge

on:
push:
branches:
- 'main'

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@v4
- name: Set up Docker Buildx 🐳
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry 🪪
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for container 📤
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Use Node 20.x 🔧
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
- name: Install App Build Dependencies 📃
run: |
npm ci
- name: Build App 🛠️
run: |
npm run build
- name: Build and push container 🚢
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
44 changes: 44 additions & 0 deletions .github/workflows/container-build-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Container Build PR

on:
pull_request:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Repository 🛎️
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for container 📤
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Use Node 20.x 🔧
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
- name: Install App Build Dependencies 📃
run: |
npm ci
- name: Build App 🛠️
run: |
npm run build
- name: Build container 📦
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ You will need to install the following programs
- [Node.js](https://nodejs.org/en/) (Use the LTS release)

Once you have installed the above, open your terminal and execute the following commands
- `git clone [email protected]:acm-uic/flourish-2023.git` (You may want to clone this to your Downloads or other folder)
- `cd flourish-2023`
- `git clone [email protected]:acm-uic/sparkhacks-2023.git` (You may want to clone this to your Downloads or other folder)
- `cd sparkhacks-2023`
- `npm install`

Once you have done these steps, you are good to go!
Expand All @@ -23,7 +23,7 @@ Running the website locally is as simple as `npm start`!

## Making a contribution

Follow the guide in the [wiki](https://github.com/acm-uic/flourish-2023/wiki/Guide-to-Contribution)
Follow the guide in the [wiki](https://github.com/acm-uic/sparkhacks-2023/wiki/Guide-to-Contribution)

### Helper scripts

Expand Down

0 comments on commit 9b7f3b7

Please sign in to comment.