-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
15,705 additions
and
10,294 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,76 @@ | ||
name: Client CI/CD | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'client/**' | ||
- '.github/workflows/client.yaml*' | ||
|
||
defaults: | ||
run: | ||
working-directory: client | ||
|
||
env: | ||
GOOGLE_CREDENTIALS: ${{ secrets.GCP_CD }} | ||
REGION: 'us-west2' | ||
PROJECT: "artist-2d" | ||
SERVICE_NAME: "artist-2d-client" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' | ||
|
||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm ci | ||
- run: npm test | ||
- run: npm run build | ||
env: | ||
NODE_OPTIONS: "--openssl-legacy-provider" | ||
|
||
deploy-gcr: | ||
name: Deploy to GCR | ||
#needs: build | ||
runs-on: ubuntu-latest | ||
#if: github.ref == 'refs/heads/main' | ||
|
||
env: | ||
IMAGE_TAG: "gcr.io/${PROJECT}/client:${GITHUB_SHA}" | ||
|
||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@main | ||
- uses: actions/checkout@v4 | ||
- name: Setup GCloud Auth | ||
id: auth | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
credentials_json: ${{ secrets.GCP_CD }} | ||
|
||
- name: Set up Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v2 | ||
|
||
# Build and push image to Google Container Registry | ||
- name: Build & Push | ||
run: gcloud builds submit --tag ${{ env.IMAGE_TAG }} | ||
env: | ||
NODE_OPTIONS: "--openssl-legacy-provider" | ||
|
||
# Deploy image to Cloud Run | ||
- name: Deploy GCR | ||
run: |- | ||
gcloud run deploy "$SERVICE_NAME" \ | ||
--quiet \ | ||
--region "$REGION" \ | ||
--image ${{ env.IMAGE_TAG }} \ | ||
--platform "managed" \ | ||
--allow-unauthenticated |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
build | ||
.dockerignore | ||
Dockerfile | ||
Dockerfile.prod | ||
.gcloudignore |
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,32 @@ | ||
# pull official base image | ||
FROM node:20.11-slim | ||
|
||
# Create a directory for our application in the container | ||
RUN mkdir -p /usr/src/app | ||
|
||
# Set this new directory as our working directory for subsequent instructions | ||
WORKDIR /usr/src/app | ||
|
||
# Copy all files in the current directory into the container | ||
COPY . . | ||
|
||
# Set the PYTHONPATH environment variable, which is occasionally necessary for certain node packages | ||
# 'PWD' is an environment variable that stores the path of the current working directory | ||
ENV PYTHONPATH=${PYTHONPATH}:${PWD} | ||
|
||
# Set the environment variable for the application's port | ||
ENV PORT 3000 | ||
|
||
# Works with newer versions of node. | ||
ENV NODE_OPTIONS "--openssl-legacy-provider" | ||
|
||
# Install 'serve', a static file serving package globally in the container | ||
RUN npm install -g serve | ||
|
||
# Install all the node modules required by the React app | ||
RUN npm install | ||
# Build the React app | ||
RUN npm run build | ||
|
||
# Serve the 'build' directory on port 3000 using 'serve' | ||
CMD ["serve", "-s", "-l", "3000", "./build"] |
Oops, something went wrong.