Skip to content

Commit

Permalink
update workflow - docker
Browse files Browse the repository at this point in the history
  • Loading branch information
bigsk1 committed Jul 7, 2024
1 parent 5f381cf commit 005c0fd
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ jobs:
run: |
npm test
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: |
cd docker
docker build -t claudeplus:$(date +%s) .
# docker-build:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Build the Docker image
# run: |
# cd docker
# docker build -t claudeplus:$(date +%s) .
10 changes: 5 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ FROM node:18 as frontend-builder
WORKDIR /app/frontend

# Copy package.json and package-lock.json
COPY ../frontend/package*.json ./
COPY frontend/package*.json ./

# Install dependencies
RUN npm install

# Copy frontend source
COPY ../frontend ./
COPY frontend ./

# Build frontend
RUN npm run build
Expand All @@ -23,19 +23,19 @@ FROM python:3.12
WORKDIR /app

# Copy backend requirements
COPY ../requirements.txt .
COPY requirements.txt .

# Install backend dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy backend source
COPY ../backend.py ../shared_utils.py ./
COPY backend.py shared_utils.py ./

# Copy built frontend
COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist

# Copy the projects folder
COPY ../projects ./projects
COPY projects ./projects

# Expose port
EXPOSE 8000
Expand Down
22 changes: 16 additions & 6 deletions docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@ FROM node:18 as frontend
WORKDIR /app/frontend

# Copy package.json and package-lock.json
COPY ../frontend/package*.json ./
COPY frontend/package*.json ./

# Install dependencies
RUN npm install

# Backend
# Backend and final image
FROM python:3.12

# Install Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs

# Set working directory
WORKDIR /app

# Copy backend requirements
COPY ../requirements.txt .
COPY requirements.txt .

# Install backend dependencies
RUN pip install --no-cache-dir -r requirements.txt
Expand All @@ -26,16 +30,22 @@ RUN pip install --no-cache-dir -r requirements.txt
RUN pip install uvicorn

# Copy backend source
COPY ../backend.py ../shared_utils.py ./
COPY backend.py shared_utils.py ./

# Copy the projects folder
COPY ../projects ./projects
COPY projects ./projects

# Copy frontend files
COPY frontend /app/frontend

# Install frontend dependencies
RUN cd /app/frontend && npm install

# Expose ports
EXPOSE 8000 5173

# Copy the start script
COPY start-dev.sh /start-dev.sh
COPY docker/start-dev.sh /start-dev.sh
RUN chmod +x /start-dev.sh

# Set the entrypoint
Expand Down
3 changes: 2 additions & 1 deletion docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ services:
- PYTHONUNBUFFERED=1
- NODE_ENV=development
stdin_open: true
tty: true
tty: true
command: /bin/sh -c "cd /app/frontend && npm install --verbose && /start-dev.sh"

0 comments on commit 005c0fd

Please sign in to comment.