Skip to content

Commit

Permalink
Merge pull request #79 from ciatph/dev
Browse files Browse the repository at this point in the history
v1.1.5
  • Loading branch information
ciatph authored Sep 29, 2024
2 parents 0d20f60 + 1bc5a8c commit 359c748
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 82 deletions.
31 changes: 30 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
jobs:
lint-client:
name: Lint and Build client
if: github.event.release.target_commitish == 'master'
runs-on: ubuntu-latest
env:
REACT_APP_BASE_URL: ${{ secrets.REACT_APP_BASE_URL }}
Expand Down Expand Up @@ -46,6 +47,7 @@ jobs:

lint-server:
name: Lint Server
if: github.event.release.target_commitish == 'master'
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -67,6 +69,7 @@ jobs:
deploy-client:
name: Deploy Client to Firebase Hosting
if: github.event.release.target_commitish == 'master'
needs: lint-client
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -108,8 +111,10 @@ jobs:
- run: git push heroku HEAD:refs/heads/master
- run: rm -r -f .netrc

# Push the complete "app" Docker image
docker-build-push:
name: Deploy to Docker Hub
name: Deploy App to Docker Hub
if: github.event.release.target_commitish == 'master'
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
Expand All @@ -133,3 +138,27 @@ jobs:
run: docker compose -f docker-compose.app.yml build
- name: Push Images to Docker Hub
run: docker compose -f docker-compose.app.yml push

# Push the development (client/server) Docker images
docker-build-push-dev:
name: Deploy Development to Docker Hub
if: github.event.release.target_commitish == 'master'
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout the repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
- name: Create temporary env variables
run: |
cp client/.env.example client/.env
cp server/.env.example server/.env
- name: Build Images
run: docker compose -f docker-compose.dev.yml build
- name: Push Images to Docker Hub
run: docker compose -f docker-compose.dev.yml push
136 changes: 88 additions & 48 deletions README.md

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion client/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
REACT_APP_BASE_URL=http://localhost:3001/api
REACT_APP_BASE_URL=http://localhost:3001/api
REACT_APP_FIREBASE_API_KEY=AIzaSyB1SivNCSCPXFV4v4FhE-Ll2av8nHEWr-8
REACT_APP_FIREBASE_AUTHDOMAIN=users-admin-firebase.firebaseapp.com
REACT_APP_FIREBASE_PROJECT_ID=users-admin-firebase
REACT_APP_FIREBASE_STORAGE_BUCKET=users-admin-firebase.appspot.com
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=761515421472
REACT_APP_FIREBASE_APP_ID=1:761515421472:web:d7c737ba274515297f3145
REACT_APP_FIREBASE_MEASUREMENT_ID=G-ZCWY6YX0P0
2 changes: 1 addition & 1 deletion client/src/components/common/navigation/userbutton.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Link } from 'react-router-dom'
import { auth, signOut } from '../../../utils/firebase/firebase.config'
import { auth, signOut } from '../../../config/firebase.config'

function UserButton (hasUser) {
const logout = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { getAuth, signOut, signInWithEmailAndPassword } from 'firebase/auth'
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: 'AIzaSyB1SivNCSCPXFV4v4FhE-Ll2av8nHEWr-8',
authDomain: 'users-admin-firebase.firebaseapp.com',
projectId: 'users-admin-firebase',
storageBucket: 'users-admin-firebase.appspot.com',
messagingSenderId: '761515421472',
appId: '1:761515421472:web:d7c737ba274515297f3145',
measurementId: 'G-ZCWY6YX0P0'
apiKey: process.env.REACT_APP_FIREBASE_API_KEY,
authDomain: process.env.REACT_APP_FIREBASE_AUTHDOMAIN,
projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID,
storageBucket: process.env.REACT_APP_FIREBASE_STORAGE_BUCKET,
messagingSenderId: process.env.REACT_APP_FIREBASE_MESSAGING_SENDER_ID,
appId: process.env.REACT_APP_FIREBASE_APP_ID,
measurementId: process.env.REACT_APP_FIREBASE_MEASUREMENT_ID
}

// Initialize Firebase
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/login/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react'
import PropTypes from 'prop-types'
import { auth, signInWithEmailAndPassword } from '../../utils/firebase/firebase.config'
import { auth, signInWithEmailAndPassword } from '../../config/firebase.config'
import Login from '../../components/common/form'
import AlertMessage from '../../components/common/alert_message'

Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/login/withauth.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react'
import { auth, signOut } from '../../utils/firebase/firebase.config'
import { auth, signOut } from '../../config/firebase.config'

const WithAuth = (Component) => {
function AuthAwareComponent (props) {
Expand Down
2 changes: 1 addition & 1 deletion client/src/utils/service/service.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios from 'axios'
import { auth } from '../firebase/firebase.config'
import { auth } from '../../config/firebase.config'

export default class Service {
constructor () {
Expand Down
14 changes: 7 additions & 7 deletions docker-compose.app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# - Express backend that restarts itself on errors running on pm2
# - Create React App (CRA) client served from a static directory (using express.static() middleware)
# Requirements: Disable CORS to allow Same Origin headers on client and server APIs
version: "3"

services:
# Built Create React App (CRA) website running on nginx
firebase-users-admin-app:
container_name: firebase-users-admin-app
image: ciatphdev/firebase-users-admin-app:latest
firebase-users-app:
container_name: firebase-users-app
image: ciatphdev/firebase-users-app:latest
restart: always
env_file:
- ./server/.env
Expand All @@ -17,11 +17,11 @@ services:
dockerfile: Dockerfile.app
target: production
networks:
- firebase-users-admin-app
- firebase-users-app
ports:
- "3001:3001"

networks:
firebase-users-admin-app:
name: firebase-users-admin-app
firebase-users-app:
name: firebase-users-app
external: false
13 changes: 6 additions & 7 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
version: "3"
services:
# Create React App (CRA) running on development mode
client-dev:
container_name: client-dev
image: ciatphdev/firebase-users-admin-client:dev
image: ciatphdev/firebase-users-client:dev
env_file:
- ./client/.env
build:
context: ./client
dockerfile: Dockerfile
target: development
networks:
- firebase-users-admin-dev
- firebase-users-dev
volumes:
- ./client/public:/opt/client/public
- ./client/src:/opt/client/src
Expand All @@ -21,21 +20,21 @@ services:
# Express app running in development mode with auto reload using nodemon
server-dev:
container_name: server-dev
image: ciatphdev/firebase-users-admin-server:dev
image: ciatphdev/firebase-users-server:dev
env_file:
- ./server/.env
build:
context: ./server
dockerfile: Dockerfile
target: development
networks:
- firebase-users-admin-dev
- firebase-users-dev
volumes:
- ./server/src:/opt/server/src
ports:
- "3001:3001"

networks:
firebase-users-admin-dev:
name: firebase-users-admin-dev
firebase-users-dev:
name: firebase-users-dev
external: false
13 changes: 6 additions & 7 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Builds (2) separate images for the client and server

version: "3"
services:
# Build Create React App (CRA) website running on nginx container
client-prod:
container_name: client-prod
image: ciatphdev/firebase-users-admin-client:latest
image: ciatphdev/firebase-users-client:latest
restart: always
env_file:
- ./client/.env
Expand All @@ -14,14 +13,14 @@ services:
dockerfile: Dockerfile
target: production
networks:
- firebase-users-admin
- firebase-users
ports:
- "3000:3000"

# Express app (backend only) that restarts itself on errors using pm2
server-prod:
container_name: server-prod
image: ciatphdev/firebase-users-admin-server:latest
image: ciatphdev/firebase-users-server:latest
restart: always
env_file:
- ./server/.env
Expand All @@ -30,11 +29,11 @@ services:
dockerfile: Dockerfile
target: production
networks:
- firebase-users-admin
- firebase-users
ports:
- "3001:3001"

networks:
firebase-users-admin:
name: firebase-users-admin
firebase-users:
name: firebase-users
external: false

0 comments on commit 359c748

Please sign in to comment.