Closed hellojunho closed 4 months ago
[Dockerfile]
FROM ubuntu:22.04 RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/kr.archive.ubuntu.com\/ubuntu\//' /etc/apt/sources.list # 캐시 클리어 및 패키지 정보 업데이트 RUN rm -rf /var/lib/apt/lists RUN mkdir /var/lib/apt/lists RUN apt-get autoclean RUN apt-get clean # RUN rm -rf /var/lib/apt/lists/* RUN apt-get update -o Acquire::http::No-Cache=True -o Acquire::BrokenProxy=true RUN apt-get install -y python3 python3-pip python3-distutils # tzdata 설정을 위한 환경변수 설정 ENV TZ=UTC RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \ && apt-get update \ && apt-get install -y tzdata WORKDIR /app ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 COPY requirements.txt /app/ RUN pip install --no-cache-dir -r requirements.txt COPY . /app/ EXPOSE 8080 CMD ["python3", "manage.py", "runserver", "0.0.0.0:8080"]
[command]
$ docker-compose build --no-cache && docker-compose up
[error code]
=> ERROR [12/13] RUN pip install --no-cache-dir -r requirements.txt > [12/13] RUN pip install --no-cache-dir -r requirements.txt: #0 0.692 Collecting asgiref==3.7.2 #0 0.801 Downloading asgiref-3.7.2-py3-none-any.whl (24 kB) #0 0.933 Collecting Django==4.2.7 #0 0.956 Downloading Django-4.2.7-py3-none-any.whl (8.0 MB) #0 1.975 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.0/8.0 MB 7.9 MB/s eta 0:00:00 #0 2.036 Collecting django-dotenv==1.4.2 #0 2.045 Downloading django_dotenv-1.4.2-py2.py3-none-any.whl (3.8 kB) #0 2.122 Collecting psycopg2==2.9.9 #0 2.147 Downloading psycopg2-2.9.9.tar.gz (384 kB) #0 2.224 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 384.9/384.9 KB 5.0 MB/s eta 0:00:00 #0 2.281 Preparing metadata (setup.py): started #0 2.416 Preparing metadata (setup.py): finished with status 'error' #0 2.420 error: subprocess-exited-with-error #0 2.420 #0 2.420 × python setup.py egg_info did not run successfully. #0 2.420 │ exit code: 1 #0 2.420 ╰─> [23 lines of output] #0 2.420 running egg_info #0 2.420 creating /tmp/pip-pip-egg-info-iq3n3k02/psycopg2.egg-info #0 2.420 writing /tmp/pip-pip-egg-info-iq3n3k02/psycopg2.egg-info/PKG-INFO #0 2.420 writing dependency_links to /tmp/pip-pip-egg-info-iq3n3k02/psycopg2.egg-info/dependency_links.txt #0 2.420 writing top-level names to /tmp/pip-pip-egg-info-iq3n3k02/psycopg2.egg-info/top_level.txt #0 2.420 writing manifest file '/tmp/pip-pip-egg-info-iq3n3k02/psycopg2.egg-info/SOURCES.txt' #0 2.420 #0 2.420 Error: pg_config executable not found. #0 2.420 #0 2.420 pg_config is required to build psycopg2 from source. Please add the directory #0 2.420 containing pg_config to the $PATH or specify the full executable path with the #0 2.420 option: #0 2.420 #0 2.420 python setup.py build_ext --pg-config /path/to/pg_config build ... #0 2.420 #0 2.420 or with the pg_config option in 'setup.cfg'. #0 2.420 #0 2.420 If you prefer to avoid building psycopg2 from source, please install the PyPI #0 2.420 'psycopg2-binary' package instead. #0 2.420 #0 2.420 For further information please check the 'doc/src/install.rst' file (also at #0 2.420 <https://www.psycopg.org/docs/install.html>). #0 2.420 #0 2.420 [end of output] #0 2.420 #0 2.420 note: This error originates from a subprocess, and is likely not a problem with pip. #0 2.421 error: metadata-generation-failed #0 2.421 #0 2.421 × Encountered error while generating package metadata. #0 2.421 ╰─> See above for output. #0 2.421 #0 2.421 note: This is an issue with the package mentioned above, not pip. #0 2.421 hint: See above for details. ------ failed to solve: executor failed running [/bin/sh -c pip install --no-cache-dir -r requirements.txt]: exit code: 1
Could you check it plz?
I confirmed this solution!
[Dockerfile]
[command]
[error code]