Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerizing and deploying on EC2 #50

Open
Soheil96 opened this issue Nov 6, 2024 · 0 comments
Open

Dockerizing and deploying on EC2 #50

Soheil96 opened this issue Nov 6, 2024 · 0 comments

Comments

@Soheil96
Copy link

Soheil96 commented Nov 6, 2024

Hi
I tried initializing your project on EC2 but it stuck at the point of asking for API Key (I have tried adjusting the .env file but no luck)
I have also tried to dockerize it but I couldn't make that work either. (attached the files, in frontend/next.config.mjs 127.0.0.1:5328 should be also changed to backend:5328)
Could you please help me with this?

docker-compose.yml:

services:
  backend:
    build:
      context: .
      dockerfile: Dockerfile.backend
    ports:
      - "5328:5328"
    volumes:
      - ./backend:/app

  frontend:
    build:
      context: .
      dockerfile: Dockerfile.frontend
    ports:
      - "3000:3000"
    volumes:
      - ./frontend:/app
    depends_on:
      - backend

Dockerfile.frontend:

FROM node:20
WORKDIR /app
COPY frontend/ /app/
RUN yarn install
EXPOSE 3000
CMD ["yarn", "dev"]

Dockerfile.backend:

FROM python:3.12
WORKDIR /app
RUN apt-get update && apt-get install -y \
    build-essential \
    libpq-dev \
    && rm -rf /var/lib/apt/lists/*
RUN pip install poetry
COPY backend/ /app/
RUN poetry install --no-dev
EXPOSE 5328
CMD ["poetry", "run", "uvicorn", "app.main:app", "--reload", "--host", "0.0.0.0", "--port", "5328", "--log-level", "info"]

all three files should be in the project root directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant