Last active
February 23, 2024 11:23
-
-
Save alexbaumgertner/6195107b2e17322d98b9c842d5290a6e to your computer and use it in GitHub Desktop.
Docker and private github packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG DEPS_IMAGE=deps-installer:latest | |
FROM $DEPS_IMAGE as deps-installer | |
FROM node:8.15.0-alpine | |
WORKDIR /app | |
COPY ./ ./ | |
COPY --from=deps-installer /deps/node_modules ./node_modules | |
RUN yarn run build-production |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:8.15.0-alpine as deps-installer | |
ARG GITHUB_TOKEN | |
ENV GITHUB_TOKEN=${GITHUB_TOKEN} | |
# For npm-packages from private github-repo (begin) | |
RUN apk add --no-cache git openssh | |
RUN git config --global url."https://${GITHUB_TOKEN}:[email protected]/".insteadOf "[email protected]:" | |
# For npm-packages from private github-repo (end) | |
WORKDIR /deps | |
COPY ./package.json ./ | |
COPY ./yarn.lock ./ | |
# `--network-concurrency 1` for MacOS | |
RUN yarn install --non-interactive --network-concurrency 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
# Additional containers | |
## Deps installing (begin) | |
deps-installer: | |
build: | |
context: . | |
dockerfile: deps-installer.Dockerfile | |
args: | |
- GITHUB_TOKEN=${GITHUB_TOKEN} | |
## Deps installing (end) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Additional containers | |
## Deps installing | |
docker-compose build deps-installer # your-prodject-name_deps-installer:latest | |
## Static files builders | |
docker-compose build app-builder # your-prodject-name__app-builder:latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment