-
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.
Answered by
crazy-max
May 15, 2024
Replies: 1 comment
-
https://docs.docker.com/build/ci/github-actions/share-image-jobs/ |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Falci
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://docs.docker.com/build/ci/github-actions/share-image-jobs/