Preparing file structure for multi service build and host.
This commit is contained in:
parent
a69c697b24
commit
3a761e3eb1
16 changed files with 89 additions and 17 deletions
15
Dockerfile
15
Dockerfile
|
|
@ -1,15 +0,0 @@
|
||||||
FROM node:23-alpine
|
|
||||||
|
|
||||||
COPY . /codered-astra
|
|
||||||
|
|
||||||
WORKDIR /codered-astra
|
|
||||||
|
|
||||||
RUN npm i
|
|
||||||
|
|
||||||
EXPOSE 3000
|
|
||||||
|
|
||||||
RUN npm run format
|
|
||||||
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
CMD ["npm", "run", "host"]
|
|
||||||
53
docker-compose.yml
Normal file
53
docker-compose.yml
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
# docker-compose.yml
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
web-app:
|
||||||
|
build:
|
||||||
|
context: ./web-app
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "80:3000"
|
||||||
|
environment:
|
||||||
|
# The connection string remains the same, but points to the 'mysql' service
|
||||||
|
- DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/${MYSQL_DATABASE}
|
||||||
|
- RUST_ENGINE_URL=http://rust-engine:8000
|
||||||
|
- GEMINI_API_KEY=${GEMINI_API_KEY}
|
||||||
|
depends_on:
|
||||||
|
- mysql # <-- Updated dependency
|
||||||
|
- rust-engine
|
||||||
|
|
||||||
|
rust-engine:
|
||||||
|
build:
|
||||||
|
context: ./rust-engine
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/${MYSQL_DATABASE}
|
||||||
|
depends_on:
|
||||||
|
- mysql # <-- Updated dependency
|
||||||
|
|
||||||
|
# --- Key Changes are in this section ---
|
||||||
|
mysql: # <-- Renamed service for clarity
|
||||||
|
image: mysql:8.0 # <-- CHANGED: Using the official MySQL 8.0 image
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
|
||||||
|
- MYSQL_DATABASE=${MYSQL_DATABASE}
|
||||||
|
- MYSQL_USER=${MYSQL_USER}
|
||||||
|
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||||
|
volumes:
|
||||||
|
- mysql-data:/var/lib/mysql
|
||||||
|
|
||||||
|
phpmyadmin:
|
||||||
|
image: phpmyadmin/phpmyadmin
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
# CHANGED: Binds port 8080 to localhost ONLY.
|
||||||
|
- "127.0.0.1:8080:80"
|
||||||
|
environment:
|
||||||
|
- PMA_HOST=mysql
|
||||||
|
depends_on:
|
||||||
|
- mysql
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mysql-data: # Renamed volume for clarity (optional but good practice)
|
||||||
0
rust-engine/Cargo.toml
Normal file
0
rust-engine/Cargo.toml
Normal file
12
rust-engine/Dockerfile
Normal file
12
rust-engine/Dockerfile
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
# rust-engine/Dockerfile
|
||||||
|
# --- Stage 1: Builder ---
|
||||||
|
FROM rust:1.7-slim as builder
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
COPY . .
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
|
# --- Stage 2: Final Image ---
|
||||||
|
FROM debian:buster-slim
|
||||||
|
COPY --from=builder /usr/src/app/target/release/rust-engine /usr/local/bin/rust-engine
|
||||||
|
EXPOSE 8000
|
||||||
|
CMD ["rust-engine"]
|
||||||
22
web-app/Dockerfile
Normal file
22
web-app/Dockerfile
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
# web-app/Dockerfile
|
||||||
|
FROM node:20-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package files first to leverage Docker's build cache
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Install all dependencies needed for the build
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# Copy the rest of your application code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Run the build script to compile the React frontend
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Expose the port your server will listen on
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# The command to start your production server
|
||||||
|
CMD ["npm", "run", "host"]
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "src"
|
"baseUrl": "web-app/src"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src"
|
"web-app/src"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
0
package-lock.json → web-app/package-lock.json
generated
0
package-lock.json → web-app/package-lock.json
generated
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Loading…
Add table
Add a link
Reference in a new issue