create a base container #299
This file contains 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
name: Build and Push | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
schedule: | |
- cron: "30 12 * * 0" # Rebuild Weekly, 12:30 Sundays picked arbitrarily | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
base: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- name: base | |
context: devcontainer/0-base | |
tag: latest | |
args: | | |
BASE_IMAGE=mcr.microsoft.com/devcontainers/base:jammy | |
- name: base | |
context: devcontainer/0-base | |
tag: node16 | |
args: | | |
NODE_MAJOR=16 | |
NPM_MAJOR=9 | |
- name: base | |
context: devcontainer/0-base | |
tag: node18 | |
args: | | |
NODE_MAJOR=18 | |
- name: base | |
context: devcontainer/0-base | |
tag: node20 | |
args: | | |
NODE_MAJOR=20 | |
- name: base | |
context: devcontainer/0-base | |
tag: node22 | |
args: | | |
NODE_MAJOR=22 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.name }} | |
ghcr.io/${{ github.repository_owner }}/${{ matrix.name }} | |
tags: | | |
type=raw,value=${{ matrix.tag }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
type=raw,value=${{ matrix.tag }}-${{ github.sha }} | |
type=raw,value=${{ matrix.tag }}-{{date 'YYYYMMDD'}},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
type=schedule,pattern=${{ matrix.tag }}-{{date 'YYYYMMDD'}} | |
labels: | | |
maintainer=Scaffoldly <docker@scaffold.ly> | |
- name: Build and push | |
id: build-push | |
uses: docker/build-push-action@v6 | |
with: | |
file: ${{ matrix.context }}/Dockerfile | |
context: ${{ matrix.context }} | |
build-args: ${{ matrix.args }} | |
platforms: linux/amd64,linux/arm64 | |
pull: true | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha,scope=${{ runner.os }}-${{ matrix.name }}-${{ matrix.tag }} | |
cache-to: type=gha,scope=${{ runner.os }}-${{ matrix.name }}-${{ matrix.tag }},mode=max | |
aws-localstack: | |
needs: | |
- base | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- name: aws-localstack | |
context: devcontainer/1-aws/localstack | |
tag: latest | |
args: | | |
BASE_IMAGE=ghcr.io/scaffoldly/base:latest | |
- name: aws-localstack | |
context: devcontainer/1-aws/localstack | |
tag: 3.1.0-node16 | |
args: | | |
BASE_IMAGE=ghcr.io/scaffoldly/base:node16 | |
LOCALSTACK_MAJOR=3 | |
LOCALSTACK_MINOR=1 | |
LOCALSTACK_PATCH=0 | |
- name: aws-localstack | |
context: devcontainer/1-aws/localstack | |
tag: 3.1.0-node18 | |
args: | | |
BASE_IMAGE=ghcr.io/scaffoldly/base:node18 | |
LOCALSTACK_MAJOR=3 | |
LOCALSTACK_MINOR=1 | |
LOCALSTACK_PATCH=0 | |
- name: aws-localstack | |
context: devcontainer/1-aws/localstack | |
tag: 3.1.0-node20 | |
args: | | |
BASE_IMAGE=ghcr.io/scaffoldly/base:node20 | |
LOCALSTACK_MAJOR=3 | |
LOCALSTACK_MINOR=1 | |
LOCALSTACK_PATCH=0 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.name }} | |
ghcr.io/${{ github.repository_owner }}/${{ matrix.name }} | |
tags: | | |
type=raw,value=${{ matrix.tag }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
type=raw,value=${{ matrix.tag }}-${{ github.sha }} | |
type=raw,value=${{ matrix.tag }}-{{date 'YYYYMMDD'}},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
type=schedule,pattern=${{ matrix.tag }}-{{date 'YYYYMMDD'}} | |
labels: | | |
maintainer=Scaffoldly <docker@scaffold.ly> | |
- name: Build and push | |
id: build-push | |
uses: docker/build-push-action@v6 | |
with: | |
file: ${{ matrix.context }}/Dockerfile | |
context: ${{ matrix.context }} | |
build-args: ${{ matrix.args }} | |
platforms: linux/amd64,linux/arm64 | |
pull: true | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha,scope=${{ runner.os }}-${{ matrix.name }}-${{ matrix.tag }} | |
cache-to: type=gha,scope=${{ runner.os }}-${{ matrix.name }}-${{ matrix.tag }},mode=max | |
# runtime: | |
# runs-on: ubuntu-latest | |
# strategy: | |
# matrix: | |
# include: | |
# - name: awslambda-nextjs | |
# context: awslambda/runtime/nextjs | |
# tag: latest | |
# args: | | |
# BASE_IMAGE=nodejs | |
# - name: awslambda-nextjs | |
# context: awslambda/runtime/nextjs | |
# tag: "14" | |
# args: | | |
# BASE_IMAGE=nodejs | |
# NEXT_MAJOR=14 | |
# - name: awslambda-nextjs | |
# context: awslambda/runtime/nextjs | |
# tag: 14-node20 | |
# args: | | |
# BASE_IMAGE=nodejs | |
# NODE_MAJOR=20 | |
# NEXT_MAJOR=14 | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# - name: Set up QEMU | |
# uses: docker/setup-qemu-action@v2 | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v2 | |
# # Dockerhub | |
# - name: Login to DockerHub | |
# uses: docker/login-action@v2 | |
# with: | |
# username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# # GHCR | |
# - name: Login to GHCR | |
# uses: docker/login-action@v2 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
# # ECR | |
# - name: Login to AWS | |
# uses: saml-to/assume-aws-role-action@v1 | |
# with: | |
# role: arn:aws:iam::557208059266:role/docker@scaffold.ly | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Get ECR Public Login | |
# id: ecr-public-login | |
# run: aws ecr-public get-login-password --region us-east-1 | |
# - name: Login to Public ECR | |
# uses: docker/login-action@v2 | |
# with: | |
# registry: public.ecr.aws | |
# username: AWS | |
# password: ${{ steps.ecr-public-login.outputs.stdout }} | |
# - name: Docker meta | |
# id: meta | |
# uses: docker/metadata-action@v4 | |
# with: | |
# images: | | |
# ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.name }} | |
# ghcr.io/${{ github.repository_owner }}/${{ matrix.name }} | |
# public.ecr.aws/${{ github.repository_owner }}/${{ matrix.name }} | |
# tags: | | |
# type=raw,value=${{ matrix.tag }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
# type=raw,value=${{ matrix.tag }}-${{ github.sha }} | |
# type=raw,value=${{ matrix.tag }}-{{date 'YYYYMMDD'}},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
# type=schedule,pattern=${{ matrix.tag }}-{{date 'YYYYMMDD'}} | |
# labels: | | |
# maintainer=Scaffoldly <docker@scaffold.ly> | |
# - name: Build and push | |
# id: build-push | |
# uses: docker/build-push-action@v4 | |
# with: | |
# file: ${{ matrix.context }}/Dockerfile | |
# context: ${{ matrix.context }} | |
# build-args: ${{ matrix.args }} | |
# platforms: linux/amd64,linux/arm64 | |
# pull: true | |
# push: true | |
# tags: ${{ steps.meta.outputs.tags }} | |
# labels: ${{ steps.meta.outputs.labels }} | |
# cache-from: type=gha,scope=${{ runner.os }}-${{ matrix.name }}-${{ matrix.tag }} | |
# cache-to: type=gha,scope=${{ runner.os }}-${{ matrix.name }}-${{ matrix.tag }},mode=max |