Skip to content

Commit

Permalink
Adding scaffold for React
Browse files Browse the repository at this point in the history
  • Loading branch information
James Bristow committed Mar 2, 2024
1 parent 5b413c6 commit 15a4bce
Show file tree
Hide file tree
Showing 24 changed files with 2,271 additions and 176 deletions.
8 changes: 8 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ PYTHON_TAG=3.11.4-buster
PYTHON_POETRY_VERSION=1.7.1
SERVER_PORT=3000

# Node
NODE_TAG=18.19.1-buster
CLIENT_PORT=8080

#NGINX
NGINX_TAG=1.25

# Postgres
POSTGRES_TAG=15.3-bullseye
DB_NAME=iris
Expand Down Expand Up @@ -39,4 +46,5 @@ ADMINER_PORT=8081

# Image Repository
GITHUB_CONTAINER_REPO_SERVER=ghcr.io/jbris/fastapi-react-graphql
GITHUB_CONTAINER_REPO_CLIENT=ghcr.io/jbris/fastapi-react-graphql-client
APP_VERSION=0.0.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Server Docker Build
name: Docker Build

on:
workflow_dispatch: {}
Expand All @@ -17,14 +17,14 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker build
run: bash ./scripts/build.sh
- name: Login to GitHub Package Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Docker build
run: bash ./scripts/build.sh
- name: Docker push
run: bash ./scripts/push.sh

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pages-build-deployment](https://github.com/JBris/fastapi-react-graphql/actions/workflows/pages/pages-build-deployment/badge.svg?branch=main)](https://github.com/JBris/fastapi-react-graphql/actions/workflows/pages/pages-build-deployment)
[![CodeQL](https://github.com/JBris/fastapi-react-graphql/actions/workflows/github-code-scanning/codeql/badge.svg?branch=main)](https://github.com/JBris/fastapi-react-graphql/actions/workflows/github-code-scanning/codeql)
[![Server Docker Build](https://github.com/JBris/fastapi-react-graphql/actions/workflows/server-docker-image.yml/badge.svg?branch=main)](https://github.com/JBris/fastapi-react-graphql/actions/workflows/server-docker-image.yml)
[![Server Docker Build](https://github.com/JBris/fastapi-react-graphql/actions/workflows/docker-image.yml/badge.svg?branch=main)](https://github.com/JBris/fastapi-react-graphql/actions/workflows/docker-image.yml)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Example of a FastAPI and React.js app using GraphQL.
3 changes: 3 additions & 0 deletions client/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VITE_APP_NAME=fastapi-react-graphql
VITE_APP_VERSION=1.0.0
VITE_GRAPHQL_URL=http://localhost:3000
3 changes: 3 additions & 0 deletions client/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VITE_APP_NAME=fastapi-react-graphql
VITE_APP_VERSION=1.0.0
VITE_GRAPHQL_URL=http://server:3000
23 changes: 23 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ARG NODE_TAG

ARG NGINX_TAG

from node:${NODE_TAG} as builder

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

RUN npm run build-production

FROM nginx:${NGINX_TAG} as deploy

COPY --from=builder /app/dist /usr/share/nginx/html

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
Loading

0 comments on commit 15a4bce

Please sign in to comment.