gitlab pypi auth

This commit is contained in:
Robert 2024-02-28 18:32:34 +07:00
parent d1bc80c7f1
commit 890494d86f
No known key found for this signature in database
GPG Key ID: F631C7FD957D5F22
3 changed files with 17 additions and 0 deletions

View File

@ -1,2 +1,8 @@
# Chain Service
DATABASE_URL=REQUIRED. Example: DATABASE_URL=mongodb://chain-service:password@127.0.0.1:27017 DATABASE_URL=REQUIRED. Example: DATABASE_URL=mongodb://chain-service:password@127.0.0.1:27017
DATABASE_NAME=OPTOINAL. Default: chain-db DATABASE_NAME=OPTOINAL. Default: chain-db
# Poetry (Gitlab Auth Token for PyPi)
POETRY_USERNAME=REQUIRED
POETRY_PASSWORD=REQUIRED

View File

@ -4,6 +4,9 @@ WORKDIR /app/
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONDONTWRITEBYTECODE 1
ARG POETRY_USERNAME
ARG POETRY_PASSWORD
RUN apk add --update --virtual .build-deps \ RUN apk add --update --virtual .build-deps \
build-base \ build-base \
python3-dev \ python3-dev \
@ -15,6 +18,7 @@ RUN pip install poetry
COPY pyproject.toml poetry.lock* /app/ COPY pyproject.toml poetry.lock* /app/
RUN poetry config virtualenvs.create false RUN poetry config virtualenvs.create false
RUN poetry config http-basic.gitlab ${POETRY_USERNAME} ${POETRY_PASSWORD}
RUN poetry install --without dev --no-interaction --no-ansi RUN poetry install --without dev --no-interaction --no-ansi

View File

@ -9,6 +9,13 @@ services:
context: . context: .
dockerfile: ./Dockerfile dockerfile: ./Dockerfile
args:
- POETRY_USERNAME=${POETRY_USERNAME}
- POETRY_PASSWORD=${POETRY_PASSWORD}
env_file:
- .env
environment: environment:
- DATABASE_URL=mongodb://chain-service:password@chain-db:27017 - DATABASE_URL=mongodb://chain-service:password@chain-db:27017