-
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.
Merge pull request #1 from aafre/frontend
Created a fully functional React Frontend
- Loading branch information
Showing
54 changed files
with
7,273 additions
and
16 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,24 @@ | ||
# Ignore local environment and secrets | ||
.env | ||
|
||
# Ignore runtime artifacts | ||
*.log | ||
*.tmp | ||
|
||
# Ignore IDE/Editor configuration and cache | ||
.vscode/ | ||
.idea/ | ||
*.swp | ||
|
||
# Ignore Python cache files and directories | ||
__pycache__/ | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
|
||
# Ignore node_modules, if applicable | ||
node_modules/ | ||
|
||
|
||
.zip |
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,64 @@ | ||
name: Build, Push, and Deploy to Cloud Run | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: # Allows manual trigger | ||
inputs: | ||
deploy: | ||
description: "Deploy to Cloud Run after building?" | ||
required: false | ||
default: "false" | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout repository code | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Authenticate with GCP | ||
- name: Authenticate with GCP | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | ||
|
||
# Set up Docker Buildx | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# Build and Push Docker Image with versioning | ||
- name: Build and Push Docker Image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
${{ secrets.CR_NAME }}:latest | ||
${{ secrets.CR_NAME }}:run-${{ github.run_number }} | ||
${{ secrets.CR_NAME }}:sha-${{ github.sha }} | ||
deploy: | ||
needs: build-and-push | ||
if: ${{ github.event.inputs.deploy == 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Authenticate with GCP | ||
- name: Authenticate with GCP | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | ||
|
||
# Deploy to Cloud Run | ||
- id: deploy-cloudrun | ||
uses: google-github-actions/deploy-cloudrun@v2 | ||
with: | ||
service: "resume-builder-app" | ||
image: "${{ secrets.CR_NAME }}:latest" | ||
region: "europe-west2" | ||
|
||
# Output deployed URL | ||
- name: Display Deployed URL | ||
run: echo "Deployed to ${{ steps.deploy-cloudrun.outputs.url }}" |
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 |
---|---|---|
@@ -1,21 +1,34 @@ | ||
# Use the official Python image as a base | ||
FROM python:3.9-slim | ||
# Step 1: Build the React app | ||
FROM node:22 AS react-build | ||
WORKDIR /app/react | ||
COPY resume-builder-ui/package*.json ./ | ||
RUN npm install | ||
COPY resume-builder-ui/ ./ | ||
RUN npm run build | ||
|
||
# Install wkhtmltopdf, xvfb, and other dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
wkhtmltopdf \ | ||
&& apt-get clean | ||
|
||
# Set the working directory | ||
# Step 2: Set up the Python (Flask) environment | ||
FROM python:3.11-slim-bullseye AS flask | ||
WORKDIR /app | ||
|
||
# Copy requirements and install Python dependencies | ||
# Install wkhtmltopdf and other dependencies | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
wkhtmltopdf \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
COPY requirements.txt . | ||
RUN pip install -r requirements.txt | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copy the application code into the container | ||
# Step 3: Copy the Flask app | ||
COPY . . | ||
|
||
# Command to run the Python script through xvfb | ||
CMD ["python", "resume_generator.py"] | ||
# Remove React code | ||
RUN rm -rf /app/resume-builder-ui | ||
|
||
# Copy React build output to Flask's static folder | ||
COPY --from=react-build /app/react/dist/ /app/static/ | ||
|
||
# Expose the port that Cloud Run requires | ||
EXPOSE 5000 | ||
|
||
# Command to run the app with gunicorn | ||
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"] |
Oops, something went wrong.