From 5f74ac7582168e486c6e2021f4a519ef8a2ceafe Mon Sep 17 00:00:00 2001 From: Joosep Alviste Date: Wed, 7 Feb 2024 08:34:06 +0200 Subject: [PATCH] build: add Docker base images Related to #83 --- packages/docker-base-images/Dockerfile.base | 3 +++ .../docker-base-images/Dockerfile.dependencies | 8 ++++++++ packages/docker-base-images/project.json | 17 +++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 packages/docker-base-images/Dockerfile.base create mode 100644 packages/docker-base-images/Dockerfile.dependencies create mode 100644 packages/docker-base-images/project.json diff --git a/packages/docker-base-images/Dockerfile.base b/packages/docker-base-images/Dockerfile.base new file mode 100644 index 0000000..ae7c81f --- /dev/null +++ b/packages/docker-base-images/Dockerfile.base @@ -0,0 +1,3 @@ +FROM node:20-alpine AS base + +RUN npm i -g pnpm@8 diff --git a/packages/docker-base-images/Dockerfile.dependencies b/packages/docker-base-images/Dockerfile.dependencies new file mode 100644 index 0000000..1d23cf6 --- /dev/null +++ b/packages/docker-base-images/Dockerfile.dependencies @@ -0,0 +1,8 @@ +FROM node:20-alpine AS base + +RUN npm i -g pnpm@8 + +# Install dependencies for compiling node-gyp (since there is no pre-built +# binary for Alpine) +# https://stackoverflow.com/a/59538284/7044732 +RUN apk add g++ make python3 diff --git a/packages/docker-base-images/project.json b/packages/docker-base-images/project.json new file mode 100644 index 0000000..e522b7f --- /dev/null +++ b/packages/docker-base-images/project.json @@ -0,0 +1,17 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "name": "@serieslist/docker-base-images", + "targets": { + "build:docker": { + "executor": "nx:run-commands", + "options": { + "cwd": "packages/docker-base-images", + "commands": [ + "docker buildx build --push --cache-to type=gha,mode=max,scope=base --cache-from type=gha,scope=base -t ghcr.io/joosepalviste/serieslist-base:latest -f Dockerfile.base .", + "docker buildx build --push --cache-to type=gha,mode=max,scope=dependencies --cache-from type=gha,scope=dependencies -t ghcr.io/joosepalviste/serieslist-base:latest -f Dockerfile.dependencies ." + ], + "parallel": true + } + } + } +}