Skip to content

fix dockerfile symlink issues #2

fix dockerfile symlink issues

fix dockerfile symlink issues #2

name: Publish Container Images
on:
push:
branches: [ main ]
tags: [ 'v*' ]
workflow_dispatch:
jobs:
push-to-registry:
name: Push containers to GitHub Container Registry
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Create empty certificate file for build
run: |
mkdir -p certs/org
touch certs/org/mitre-ca-bundle.pem
# Modified to ensure Dockerfiles exist instead of relying on symlinks
- name: Prepare Dockerfiles
run: |
# Instead of relying on symlinks, directly reference the actual files
echo "Using Dockerfile for full build"
echo "Using Dockerfile.optimized for minimal build"
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,format=long
- name: Build and push minimal container
uses: docker/build-push-action@v4
with:
context: .
# Directly use the actual Dockerfile.optimized instead of a symlink
file: ./Dockerfile.optimized
push: true
tags: |
ghcr.io/${{ github.repository }}:minimal
${{ steps.meta.outputs.tags }}-minimal
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push full container
uses: docker/build-push-action@v4
with:
context: .
# Directly use the actual Dockerfile instead of a symlink
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:full
${{ steps.meta.outputs.tags }}-full
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_TYPE=full
cache-from: type=gha
cache-to: type=gha,mode=max