From 7d149f51308441d52691d437945ef7a5bdea3045 Mon Sep 17 00:00:00 2001 From: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Thu, 8 Aug 2024 15:33:46 -0400 Subject: [PATCH] feat: dockerfiles --- .gitignore | 3 +++ memory-game/mg-backend/Dockerfile | 11 +++++++++++ memory-game/mg-backend/memory_game.db | Bin 12288 -> 24576 bytes memory-game/mg-backend/memory_game.db.bak | Bin 0 -> 12288 bytes memory-game/mg-frontend/Dockerfile | 14 ++++++++++++++ memory-game/mg-frontend/src/App.jsx | 5 +++-- .../mg-frontend/src/components/gameboard.jsx | 2 +- .../src/components/soundEffects.jsx | 12 ++++++++++++ 8 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 memory-game/mg-backend/Dockerfile create mode 100644 memory-game/mg-backend/memory_game.db.bak create mode 100644 memory-game/mg-frontend/Dockerfile create mode 100644 memory-game/mg-frontend/src/components/soundEffects.jsx diff --git a/.gitignore b/.gitignore index 491656d..a87a3bf 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ yarn-error.log* lerna-debug.log* .pnpm-debug.log* +# DBs +*.db + # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json diff --git a/memory-game/mg-backend/Dockerfile b/memory-game/mg-backend/Dockerfile new file mode 100644 index 0000000..d28608c --- /dev/null +++ b/memory-game/mg-backend/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.12 + +WORKDIR /code + +COPY ./requirements.txt /code/requirements.txt + +RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt + +COPY ./app /code/app + +CMD ["fastapi", "run", "app/main.py", "--port", "80"] diff --git a/memory-game/mg-backend/memory_game.db b/memory-game/mg-backend/memory_game.db index df67817774411fce8d877af8c6959ecbfb4bff5d..007c994cedd6b5a0e33f05246df0633f5665e439 100644 GIT binary patch literal 24576 zcmeHPU2Ggz6`t|>XLfDxP2w(=-E)(rf1Na?d<9v%_s*HRaG9MR8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wN z0!hq1*$a^OmQpF8bkjdrO89fiKl4$KFXfcYX9~sDlaz#Qaz?HJJG*CoV$crP2d)sT z>oB`FLY}tSKccMPro$ebpi|d#*pRlF>5gc};zPrs;o!v6Uep??V{0T(L9~Wi>_Te< zS|bP88rj3v$R@T%>OpJ%2T2j`rL@|pZ#)<)&FWevpDPwlY7-hK7pG&oy?{NVI(L{w z9mD9*0lZi_L*@bbsCxv~;SR_#QbjOn0+`%>3MT%wL;~mXaaz5!^uy{{ZrQaG%*WD6 zZlQ51K2JO!gF8VLL0bIv*lGSU;{yJEmd5GBmwjxbj>YjsReSW|a?-*%snS9r5G< z@Zs8W{hetMP;Ei2zWT=J;~5sSh0J>H)C3g9$vNs4cMUqQ!yFCCre#4isLni^4SR-i zHGti=MJ^$Y4yhoFRGH^j&Wn)6(}{KU$&X_R6-v2GF>{iSuuV<}ej~L;!Qdfe+&22O z#rY8pyTtN7B5>Roqy`{J1+2bxPLQB!Rad^=9ZMpcDU@Ew3W05M5-n?BP)J_=t`X$D zE+jl4VmfV{h$F*-Ed4a`i*cZ{0@X+(s1{_vEv!Z=;6bW)f@)EQ|1d5l;RVR>PV>=N zy2aJ?TyFhTh7XNrK^UhTZg3(WwhZQkYi>jx4!)>=^oW^<8<<#d6|jXXZbX`Z_HRsy zV5Sz;vhwipSa#V=E}J=>L;~C7+#E=e$SjJdZCkL*I|CEem*|$EsR=m|DTVPXqm9%N z=GT>QeO*-7=lK_7*{s8USj?VWU&1yy8}TNGuU-xtQD!=}#rg&fyNsTny>d!+rM{iJ=beXD&54tYrhqyka_sen{KDj*e*3P=T{0#X5~ zfK)&#aK;Lx;un21g9EPsrbc2bSm&K(JT=J literal 0 HcmV?d00001 diff --git a/memory-game/mg-frontend/Dockerfile b/memory-game/mg-frontend/Dockerfile new file mode 100644 index 0000000..0c6d5bd --- /dev/null +++ b/memory-game/mg-frontend/Dockerfile @@ -0,0 +1,14 @@ +FROM node:18 as build + +WORKDIR /app + +COPY . ./ +RUN npm install +ENV NODE_ENV production +RUN npm app build + + +FROM nginx:alpine +COPY --from=build /app/dist /usr/share/nginx/html + +EXPOSE 80 diff --git a/memory-game/mg-frontend/src/App.jsx b/memory-game/mg-frontend/src/App.jsx index f966e3e..b2110fb 100644 --- a/memory-game/mg-frontend/src/App.jsx +++ b/memory-game/mg-frontend/src/App.jsx @@ -4,9 +4,11 @@ import Button from "./components/button"; import GameBoard from "./components/gameboard"; import GameMessages from "./components/gameMessages"; import Scoreboard from "./components/scoreboard"; +import SoundEffects from "./components/soundEffects"; function App() { const [gameStarted, setGameStarted] = useState(false); + const [soundOn, setSoundOn] = useState(true); const [buttonText, setButtonText] = useState("Start Game!"); const [score, setScore] = useState(0); const [highScore, setHighScore] = useState(0); @@ -38,8 +40,7 @@ function App() { setMessage={setMessage} setButtonText={setButtonText} /> - - + ); } diff --git a/memory-game/mg-frontend/src/components/gameboard.jsx b/memory-game/mg-frontend/src/components/gameboard.jsx index e65628f..68ced93 100644 --- a/memory-game/mg-frontend/src/components/gameboard.jsx +++ b/memory-game/mg-frontend/src/components/gameboard.jsx @@ -46,7 +46,7 @@ export default function GameBoard(props) { } async function fetchCards({ setCards }) { - const cards = await fetch("http://localhost:8000/cards"); + const cards = await fetch("/cards"); const jsonCards = await cards.json(); let gameCards = await jsonCards.map((c) => { diff --git a/memory-game/mg-frontend/src/components/soundEffects.jsx b/memory-game/mg-frontend/src/components/soundEffects.jsx new file mode 100644 index 0000000..adf8ad6 --- /dev/null +++ b/memory-game/mg-frontend/src/components/soundEffects.jsx @@ -0,0 +1,12 @@ +export default function SoundEffects({ soundOn }) { + return ( + <> + {soundOn ? ( + <> + + + + ) : null} + + ); +}