From 4bf7d2371957b13151108ba0ebb2ea42050a4c96 Mon Sep 17 00:00:00 2001 From: Luuk Nolden Date: Wed, 15 Jan 2025 21:00:46 +0100 Subject: [PATCH 1/2] getting angular to docker --- angular/Dockerfile | 21 +++++++++++++++++++++ docker-compose.yml | 22 ++++++++++++++++------ flask/Dockerfile | 2 +- 3 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 angular/Dockerfile diff --git a/angular/Dockerfile b/angular/Dockerfile new file mode 100644 index 00000000..2229ba79 --- /dev/null +++ b/angular/Dockerfile @@ -0,0 +1,21 @@ +# Use the official Node.js image as the base image +FROM node:22 + +# Set the working directory +WORKDIR /app + +# Copy package.json and package-lock.json (if available) +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the Angular application code +COPY . . + +# Expose the port that Angular will serve on +EXPOSE 4200 + +# Run the Angular development server (ng serve) +CMD ["ng", "serve", "--host", "0.0.0.0", "--port", "4200"] + diff --git a/docker-compose.yml b/docker-compose.yml index 19c2f65e..34c0ef00 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,12 +17,22 @@ services: - "5003:5000" volumes: - ./flask:/app - - websockets: + + angular: build: - context: ./websockets - dockerfile: Dockerfile.websockets + context: ./angular + dockerfile: Dockerfile ports: - - "5004:5000" + - "4200:4200" volumes: - - ./websockets:/app_websockets + - ./angular:/app + command: ["ng", "serve", "--host", "0.0.0.0", "--port", "4200"] + + #websockets: + #build: + #context: ./websockets + #dockerfile: Dockerfile.websockets + #ports: + #- "5004:5000" + #volumes: + #- ./websockets:/app_websockets diff --git a/flask/Dockerfile b/flask/Dockerfile index 87c3a927..40d3a9bc 100644 --- a/flask/Dockerfile +++ b/flask/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10-slim-buster +FROM python:3.12-slim-bookworm WORKDIR /app COPY ./requirements.txt . RUN pip install --no-cache-dir -r requirements.txt From b0b28cd8a2c30c37df0577e1d4f00b74c1a67e72 Mon Sep 17 00:00:00 2001 From: Luuk Nolden Date: Sat, 18 Jan 2025 11:53:55 +0100 Subject: [PATCH 2/2] Angular now working, and some tmux! --- angular/Dockerfile | 3 +++ tmux.sh | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 tmux.sh diff --git a/angular/Dockerfile b/angular/Dockerfile index 2229ba79..2602f425 100644 --- a/angular/Dockerfile +++ b/angular/Dockerfile @@ -7,6 +7,9 @@ WORKDIR /app # Copy package.json and package-lock.json (if available) COPY package*.json ./ +# Install Angular CLI globally +RUN npm install -g @angular/cli + # Install dependencies RUN npm install diff --git a/tmux.sh b/tmux.sh new file mode 100755 index 00000000..b844d4e1 --- /dev/null +++ b/tmux.sh @@ -0,0 +1,22 @@ +# Start tmux session +tmux new-session -d -s my_session + +# Run docker-compose up -d in the first pane +tmux send-keys "docker compose up -d" C-m + +sleep 1 + +# Run docker-compose logs -f flask in the new pane +tmux send-keys "docker compose logs -f flask" C-m + +# Split the window horizontally (or vertically) for the second pane +tmux split-window -v + +# Run docker-compose logs -f angular in the third pane +tmux send-keys "docker compose logs -f angular" C-m + +tmux rename-window 'dockers' + +# Attach to the tmux session +tmux attach -t my_session +