diff --git a/README.md b/README.md index e69de29b..561e708d 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,20 @@ +# Cliff Hill's Coding Project + +## AI Use + +I used AI to stub out a couple of files: +* The backend/Dockerfile and frontend/Dockerfile - to speed up the process of getting docker loaded efficiently for the project. +* The compose.yml file - getting the different images gathered together quickly. +* The mermaid diagrams used in this file. + +## Diagrams + +Docker Compose Components: + +```mermaid +graph TD + A[Frontend] -->|HTTP/REST| B[Backend] + B -->|SQL| C[Postgres] + A -->|Docker Network| B + B -->|Docker Network| C +``` diff --git a/backend/Dockerfile b/backend/Dockerfile index 29d08fb3..d30e686b 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -15,9 +15,11 @@ WORKDIR /app # Copy the Poetry configuration files COPY pyproject.toml poetry.lock ./ +# Add the poetry plugin for exporting dependencies +RUN poetry self add poetry-plugin-export # Export dependencies to requirements.txt # This will create a requirements.txt file with the dependencies listed in pyproject.toml -RUN poetry export -f requirements.txt --output requirements.txt --without-hashes --no-dev +RUN poetry export -f requirements.txt --output requirements.txt --without-hashes # Final stage # Use a fresh Python image to keep the final image small diff --git a/frontend/Dockerfile b/frontend/Dockerfile index ee5f7d05..a0423a6b 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,5 +1,10 @@ +FROM node:24.6.0-slim AS base + +# Installing npm globally to ensure the latest version is used +RUN npm install --location=global npm@latest + # Build stage -FROM node:24.6.0 AS builder +FROM base AS builder # Setting working directory for build WORKDIR /app @@ -10,23 +15,26 @@ COPY package*.json ./ # Copying TypeScript configuration COPY tsconfig.json ./ +# Copying yarn configuration files +COPY yarn.lock ./ + # Installing dependencies -RUN npm install +RUN yarn install --frozen-lockfile # Copying the rest of the application code COPY . . # Building the TypeScript React app for production -RUN npm run build +RUN yarn run build # Production stage -FROM node:24.6.0-slim +FROM base # Setting working directory WORKDIR /app # Installing serve to run the production build -RUN npm install -g serve +RUN yarn global add serve # Copying only the build output from the builder stage COPY --from=builder /app/build ./build diff --git a/frontend/yarn.lock b/frontend/yarn.lock index d016c5cf..96ccfa39 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -2082,9 +2082,9 @@ integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== "@types/node-forge@^1.3.0": - version "1.3.13" - resolved "https://registry.yarnpkg.com/@types/node-forge/-/node-forge-1.3.13.tgz#1797af20f7eccaf5f37b4d1739923bb0519d95b6" - integrity sha512-zePQJSW5QkwSHKRApqWCVKeKoSOt4xvEnLENZPjyvm9Ezdf/EyDeJM7jqLzOwjVICQQzvLZ63T55MKdJB5H6ww== + version "1.3.14" + resolved "https://registry.yarnpkg.com/@types/node-forge/-/node-forge-1.3.14.tgz#006c2616ccd65550560c2757d8472eb6d3ecea0b" + integrity sha512-mhVF2BnD4BO+jtOp7z1CdzaK4mbuK0LLQYAvdOLqHTavxFNq4zA1EmYkpnFjP8HOUzedfQkRnp0E2ulSAYSzAw== dependencies: "@types/node" "*" @@ -3049,7 +3049,7 @@ browser-process-hrtime@^1.0.0: resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== -browserslist@^4.0.0, browserslist@^4.18.1, browserslist@^4.21.4, browserslist@^4.24.0, browserslist@^4.24.4, browserslist@^4.25.1: +browserslist@^4.0.0, browserslist@^4.18.1, browserslist@^4.21.4, browserslist@^4.24.0, browserslist@^4.24.4, browserslist@^4.25.3: version "4.25.3" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.25.3.tgz#9167c9cbb40473f15f75f85189290678b99b16c5" integrity sha512-cDGv1kkDI4/0e5yON9yM5G/0A5u8sf5TnmdX5C9qHzI9PPu++sQ9zjm1k9NiOrf3riY4OkK0zSGqfvJyJsgCBQ== @@ -3396,21 +3396,21 @@ cookie@0.7.1: integrity sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w== core-js-compat@^3.43.0: - version "3.45.0" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.45.0.tgz#bc0017525dcb7a42ba3241d02f6fce9bae8e5c33" - integrity sha512-gRoVMBawZg0OnxaVv3zpqLLxaHmsubEGyTnqdpI/CEBvX4JadI1dMSHxagThprYRtSVbuQxvi6iUatdPxohHpA== + version "3.45.1" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.45.1.tgz#424f3f4af30bf676fd1b67a579465104f64e9c7a" + integrity sha512-tqTt5T4PzsMIZ430XGviK4vzYSoeNJ6CXODi6c/voxOT6IZqBht5/EKaSNnYiEjjRYxjVz7DQIsOsY0XNi8PIA== dependencies: - browserslist "^4.25.1" + browserslist "^4.25.3" core-js-pure@^3.23.3: - version "3.45.0" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.45.0.tgz#c753b80daf1bf732e56bf0b8cbd62797c0c1f235" - integrity sha512-OtwjqcDpY2X/eIIg1ol/n0y/X8A9foliaNt1dSK0gV3J2/zw+89FcNG3mPK+N8YWts4ZFUPxnrAzsxs/lf8yDA== + version "3.45.1" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.45.1.tgz#b129d86a5f7f8380378577c7eaee83608570a05a" + integrity sha512-OHnWFKgTUshEU8MK+lOs1H8kC8GkTi9Z1tvNkxrCcw9wl3MJIO7q2ld77wjWn4/xuGrVu2X+nME1iIIPBSdyEQ== core-js@^3.19.2: - version "3.45.0" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.45.0.tgz#556c2af44a2d9c73ea7b49504392474a9f7c947e" - integrity sha512-c2KZL9lP4DjkN3hk/an4pWn5b5ZefhRJnAc42n6LJ19kSnbeRbdQZE5dSeE2LBol1OwJD3X1BQvFTAsa8ReeDA== + version "3.45.1" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.45.1.tgz#5810e04a1b4e9bc5ddaa4dd12e702ff67300634d" + integrity sha512-L4NPsJlCfZsPeXukyzHFlg/i7IIVwHSItR0wg0FLNqYClJ4MQYTYLbC7EkjKYRLZF2iof2MUgN0EGy7MdQFChg== core-util-is@~1.0.0: version "1.0.3"