1
0

Add build environment

This commit is contained in:
David Boreham 2023-01-06 13:54:03 -07:00
parent 6e67a59251
commit 318d70020e
3 changed files with 13 additions and 7 deletions

View File

@ -64,6 +64,12 @@ def command(ctx, include, exclude):
if verbose: if verbose:
print(f'Containers: {containers}') print(f'Containers: {containers}')
# TODO: make this configurable
container_build_env = {
"CERC_NPM_URL": "http://host.docker.internal:3000/api/packages/cerc-io/npm/",
"CERC_NPM_AUTH_TOKEN": os.environ["CERC_NPM_AUTH_TOKEN"]
}
def process_container(container): def process_container(container):
if not quiet: if not quiet:
print(f"Building: {container}") print(f"Building: {container}")

View File

@ -7,8 +7,8 @@ ARG USERNAME=node
ARG NPM_GLOBAL=/usr/local/share/npm-global ARG NPM_GLOBAL=/usr/local/share/npm-global
# This container pulls npm packages from a local registry configured via these env vars # This container pulls npm packages from a local registry configured via these env vars
ARG CERC_LOCAL_NPM_URL ARG CERC_NPM_URL
ARG CERC_LOCAL_NPM_TOKEN ARG CERC_NPM_AUTH_TOKEN
# Add NPM global to PATH. # Add NPM global to PATH.
ENV PATH=${NPM_GLOBAL}/bin:${PATH} ENV PATH=${NPM_GLOBAL}/bin:${PATH}
@ -40,10 +40,10 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# RUN su node -c "npm install -g <your-package-list-here>" # RUN su node -c "npm install -g <your-package-list-here>"
# Configure the local npm registry # Configure the local npm registry
RUN npm config set @lirewine:registry ${CERC_LOCAL_NPM_URL} \ RUN npm config set @lirewine:registry ${CERC_NPM_URL} \
&& npm config set @cerc-io:registry ${CERC_LOCAL_NPM_URL} \ && npm config set @cerc-io:registry ${CERC_NPM_URL} \
&& npm config set @lirewine:registry ${CERC_LOCAL_NPM_URL} \ && npm config set @lirewine:registry ${CERC_NPM_URL} \
&& npm config set -- ${CERC_LOCAL_NPM_URL}:_authToken ${CERC_LOCAL_NPM_TOKEN} && npm config set -- ${CERC_NPM_URL}:_authToken ${CERC_NPM_AUTH_TOKEN}
# TODO: the image at this point could be made a base image for several different CLI images # TODO: the image at this point could be made a base image for several different CLI images
# that install different Node-based CLI commands # that install different Node-based CLI commands

View File

@ -6,4 +6,4 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
docker build -t cerc/laconic-registry-cli:local -f ${SCRIPT_DIR}/Dockerfile \ docker build -t cerc/laconic-registry-cli:local -f ${SCRIPT_DIR}/Dockerfile \
--add-host host.docker.internal:host-gateway \ --add-host host.docker.internal:host-gateway \
--build-arg CERC_LOCAL_NPM_TOKEN --build-arg CERC_LOCAL_NPM_URL ${SCRIPT_DIR} --build-arg CERC_NPM_AUTH_TOKEN --build-arg CERC_NPM_URL ${SCRIPT_DIR}