Skip to content

Commit

Permalink
Merge pull request #111 from amosproj/88-bug-fix-local-setup-for-ever…
Browse files Browse the repository at this point in the history
…y-chip-based-system-win-linux-macos-intel-macos-arm

88 bug fix local setup for every chip based system win linux macos intel macos arm
  • Loading branch information
ddeli authored Dec 1, 2024
2 parents c612a57 + 5bda2d2 commit 9e13836
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 41 deletions.
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ FROM node:18-bullseye
WORKDIR /app

COPY package*.json ./
#ENV NODE_ENV=development

RUN npm i -g [email protected]
RUN npm i
COPY . .
#RUN npm ci
RUN npm ci
COPY . .
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,24 @@ Make sure the following are installed on your machine:

3. **Setup .env files**:

```bash
cp .env.docker.example .env.docker
In the projects root folder, copy the **.env.docker.example** and rename the copy to **.env.docker**

```

4. **Copy database dump into project**:

Copy the database dump .dmp file in the projects root folder and rename it to **db_dump.sql**
Copy the database dump .dmp file into the projects root folder and rename it to **db_dump.sql**

5. **Clean Docker node_modules**:
5. **Build Docker container**:

```bash
docker volume rm amos2024ws02-backup-metadata-analyzer_mono-node-modules
docker compose --env-file .env.docker build --no-cache

```

6. **Build and start Docker container**:
6. **Start Docker container**:

```bash
docker compose --env-file .env.docker up --build
docker compose --env-file .env.docker up

```

Expand Down
33 changes: 15 additions & 18 deletions apps/analyzer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
# Use Alpine 3.17, which supports Python 3.11
FROM node:18-alpine3.17

# Install Python 3.11 and other dependencies
RUN apk add --no-cache python3 py3-pip python3-dev gcc musl-dev libffi-dev openssl-dev bash
FROM python:3.11-slim-buster

# Create the virtual environment
RUN python3 -m venv /app/.venv
WORKDIR /app

# Set the virtual environment path
ENV PATH="/app/.venv/bin:$PATH"
COPY pyproject.toml poetry.lock ./

# Install Poetry
RUN pip install --no-cache --upgrade pip setuptools && \
pip install poetry
#Install Python and Pipx
RUN python3 -m pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir pipx && \
pipx ensurepath

# Copy the dependency files
WORKDIR /app
COPY pyproject.toml poetry.lock ./
# Install Poetry with pipx
RUN pipx install poetry

# Add Poetry to PATH
ENV PATH="/root/.local/bin:$PATH"

# Install dependencies with Poetry
RUN poetry config virtualenvs.create false && \
poetry install --no-interaction --no-ansi
#Install dependencies outside of the venv
RUN poetry config virtualenvs.create false
RUN poetry install --no-interaction --no-ansi --verbose

#Copy the remaining code
COPY . .

# Standard command to start the application
#CMD ["/app/.venv/bin/python3", "main.py" , "--host", "0.0.0.0"]
17 changes: 6 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ networks:
driver: bridge

services:
# Angular Frontend App
# # Angular Frontend App

frontend:
extends:
file: docker-compose.base.yml

service: nx-app-base

#command: npm run frontend:dev:docker
#command: ['npm', 'run', 'fe-docker']
command: nx serve metadata-analyzer-frontend --host 0.0.0.0

ports:
Expand All @@ -30,8 +28,6 @@ services:

service: nx-app-base

#command: npm run backend:dev:docker
#command: ['npm', 'run', 'be', '--host localhost']
command: nx serve metadata-analyzer-backend --host 0.0.0.0
environment:
- ANALYZER_URL=${ANALYZER_URL}
Expand Down Expand Up @@ -61,17 +57,15 @@ services:

# - 4311:4311 # Server Debugging port

# Python Analyzer Backend App
# Python Analyzer Backend App

analyzer:
# extends:
# file: docker-compose.base.yml

# service: nx-app-base
build:
context: ./apps/analyzer
dockerfile: Dockerfile
command: ['/app/.venv/bin/python3', 'main.py', '--host', '0.0.0.0']

command: ['python3.11', 'main.py', '--host', '0.0.0.0']

environment:
# Flask
- FLASK_RUN_HOST=${ANALYZER_FLASK_RUN_HOST}
Expand Down Expand Up @@ -107,6 +101,7 @@ services:
POSTGRES_DB: postgres
networks:
- app-network

# Analyzer Database
analyzerDatabase:
image: postgres
Expand Down

0 comments on commit 9e13836

Please sign in to comment.