Skip to content

Commit

Permalink
Angular to Docker (#314)
Browse files Browse the repository at this point in the history
* getting angular to docker

* Angular now working, and some tmux!
  • Loading branch information
Ycreak authored Jan 18, 2025
1 parent 7ee2f94 commit 627ad30
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 7 deletions.
24 changes: 24 additions & 0 deletions angular/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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 Angular CLI globally
RUN npm install -g @angular/cli

# 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"]

22 changes: 16 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion flask/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
22 changes: 22 additions & 0 deletions tmux.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 627ad30

Please sign in to comment.