and I get this error:
\nError: buildx failed with: ERROR: failed to solve: failed to resolve source metadata for docker.io/library/nb-gh:aa2d155f8c3ef332a798d428d1404a0f28ea2d10: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed\nI tried adding cache-from/to: type=gha, no success.
Similar to #670, but with more than just FROM
FROM node:16-alpine as builder\n\nWORKDIR /usr/src/app\n\n## OS required dependencies\nRUN apk upgrade --no-cache && apk --no-cache --update --virtual build-dependencies add \\\n python3 make g++ unbound-dev gmp-dev openssh-client git gcompat\n\n## Global dependencies\nRUN npm i -g sequelize\n\n## Install dependencies\nCOPY . .\nRUN npm ci\n\n## Base env config\nCOPY .env.config /usr/src/app/.env\n\n## Build\nRUN NODE_ENV=production npm run build\n\n## Remove some uncessary files\nRUN rm -rf lib/migrations/**/*.map && rm -rf lib/seeders/**/*.map\n\nFROM node:16-alpine as runtime \n\nWORKDIR /usr/src/app\n\nUSER node\n\n## Copy files from builder\nCOPY --from=builder --chown=node:node /usr/src/app/node_modules /usr/src/app/node_modules\nCOPY --from=builder --chown=node:node /usr/src/app/lib /usr/src/app/lib\nCOPY --from=builder --chown=node:node /usr/src/app/dist /usr/src/app/dist\nCOPY --from=builder --chown=node:node /usr/src/app/public /usr/src/app/public\n\nCMD [\"/sbin/tini\", \"node\", \"./lib/server/index.js\"]\n\n## Extra targets\n\nFROM runtime as lint\nRUN npx flow\n\nFROM runtime as test\n\nENV NODE_ENV=test\nENV NODE_CONFIG_DIR=./lib/config\n\nRUN npx mocha --recursive -r @babel/register -r dotenv/config --exit --colors --diff --timeout 15000 --full-trace true --retries 3https://docs.docker.com/build/ci/github-actions/share-image-jobs/
","upvoteCount":1,"url":"https://github.com/docker/build-push-action/discussions/1123#discussioncomment-9447287"}}}-
|
I have two jobs (for now). The first should build the image (there are some steps omitted) and the second should used for lint jobs:
setup:
name: 🔧 Setup
runs-on: ubuntu-latest
steps:
- name: ✅ Checkout
uses: actions/checkout@v4
- name: 🐳 Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 🐳 Build base image
uses: docker/build-push-action@v5
with:
context: nb
file: nb/Dockerfile.github
load: true
tags: nb-gh:${{ github.sha }}
target: runtime
lint:
name: 🔎 Lint
runs-on: ubuntu-latest
needs: setup
steps:
- name: ✅ Checkout
uses: actions/checkout@v4
- name: 🐳 Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 🔎 Flow check
uses: docker/build-push-action@v5
with:
context: nb
file: nb/Dockerfile.github
target: lint
push: false
tags: nb-gh-lint:latest
build-contexts: runtime=docker-image://nb-gh:${{ github.sha }}and I get this error: I tried adding Similar to #670, but with more than just DockerfileFROM node:16-alpine as builder
WORKDIR /usr/src/app
## OS required dependencies
RUN apk upgrade --no-cache && apk --no-cache --update --virtual build-dependencies add \
python3 make g++ unbound-dev gmp-dev openssh-client git gcompat
## Global dependencies
RUN npm i -g sequelize
## Install dependencies
COPY . .
RUN npm ci
## Base env config
COPY .env.config /usr/src/app/.env
## Build
RUN NODE_ENV=production npm run build
## Remove some uncessary files
RUN rm -rf lib/migrations/**/*.map && rm -rf lib/seeders/**/*.map
FROM node:16-alpine as runtime
WORKDIR /usr/src/app
USER node
## Copy files from builder
COPY --from=builder --chown=node:node /usr/src/app/node_modules /usr/src/app/node_modules
COPY --from=builder --chown=node:node /usr/src/app/lib /usr/src/app/lib
COPY --from=builder --chown=node:node /usr/src/app/dist /usr/src/app/dist
COPY --from=builder --chown=node:node /usr/src/app/public /usr/src/app/public
CMD ["/sbin/tini", "node", "./lib/server/index.js"]
## Extra targets
FROM runtime as lint
RUN npx flow
FROM runtime as test
ENV NODE_ENV=test
ENV NODE_CONFIG_DIR=./lib/config
RUN npx mocha --recursive -r @babel/register -r dotenv/config --exit --colors --diff --timeout 15000 --full-trace true --retries 3 |
Beta Was this translation helpful? Give feedback.
-
|
https://docs.docker.com/build/ci/github-actions/share-image-jobs/ |
Beta Was this translation helpful? Give feedback.
https://docs.docker.com/build/ci/github-actions/share-image-jobs/