feat: dockerfiles

This commit is contained in:
Mike 2024-08-08 15:33:46 -04:00
parent 8398636f01
commit 7d149f5130
8 changed files with 44 additions and 3 deletions

3
.gitignore vendored
View file

@ -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

View 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.

View 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

View file

@ -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} />
</>
);
}

View file

@ -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) => {

View 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}
</>
);
}