mirror of
https://gitea.smigz.com/smiggiddy/odin-codeprojects.git
synced 2024-12-26 14:20:43 -05:00
feat: dockerfiles
This commit is contained in:
parent
8398636f01
commit
7d149f5130
8 changed files with 44 additions and 3 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -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
|
||||
|
||||
|
|
11
memory-game/mg-backend/Dockerfile
Normal file
11
memory-game/mg-backend/Dockerfile
Normal file
|
@ -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"]
|
Binary file not shown.
BIN
memory-game/mg-backend/memory_game.db.bak
Normal file
BIN
memory-game/mg-backend/memory_game.db.bak
Normal file
Binary file not shown.
14
memory-game/mg-frontend/Dockerfile
Normal file
14
memory-game/mg-frontend/Dockerfile
Normal file
|
@ -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
|
|
@ -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}
|
||||
/>
|
||||
<audio src="public/collect-5930.mp3" className="audio-right"></audio>
|
||||
<audio src="public/incorrect.mp3" className="audio-wrong"></audio>
|
||||
<SoundEffects soundOn={soundOn} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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) => {
|
||||
|
|
12
memory-game/mg-frontend/src/components/soundEffects.jsx
Normal file
12
memory-game/mg-frontend/src/components/soundEffects.jsx
Normal file
|
@ -0,0 +1,12 @@
|
|||
export default function SoundEffects({ soundOn }) {
|
||||
return (
|
||||
<>
|
||||
{soundOn ? (
|
||||
<>
|
||||
<audio src="/collect-5930.mp3" className="audio-right"></audio>
|
||||
<audio src="/incorrect.mp3" className="audio-wrong"></audio>
|
||||
</>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
Loading…
Reference in a new issue