Skip to content

Instantly share code, notes, and snippets.

@hankehly
Created September 15, 2022 00:44
Show Gist options
  • Save hankehly/ec9331a1bc9745050ebe2066c753c4d2 to your computer and use it in GitHub Desktop.
Save hankehly/ec9331a1bc9745050ebe2066c753c4d2 to your computer and use it in GitHub Desktop.
Blog Article Snippets - How to share private code without exposing it to the world
FROM python:3.10.6
ARG CODEARTIFACT_USER
ARG CODEARTIFACT_AUTH_TOKEN
ARG CODEARTIFACT_REPOSITORY_URL
ENV POETRY_VERSION=1.1.15 \
POETRY_HOME=/usr/local
COPY pyproject.toml poetry.lock .
RUN apt update \
&& apt install -y wget \
 && apt clean \
 && wget https://install.python-poetry.org -O - | python - \
 && poetry config repositories.test123 $CODEARTIFACT_REPOSITORY_URL \
 && poetry config http-basic.test123 ${CODEARTIFACT_USER} ${CODEARTIFACT_AUTH_TOKEN} \
 && poetry install \
 && poetry config --unset http-basic.test
[tool.poetry]
name = "app"
version = "0.1.0"
description = "app"
authors = ["example <example@example.com>"]
[[tool.poetry.source]]
name = "test123_codeartifact"
url = "https://<my_domain>-<account_id>.d.codeartifact.<region>.amazonaws.com/pypi/test123/simple/"
[tool.poetry.dependencies]
python = "3.10"
test123 = {version = "*", source = "test123_codeartifact"}
requests = "*"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment