Docker image #15
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: Docker image | |
on: | |
workflow_dispatch: | |
permissions: | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
# Test modern Odoo versions with latest Postgres version | |
odoo_version: ["16.0"] | |
platforms: ["linux/amd64,linux/arm64"] | |
include: | |
# Older odoo versions don't support latest postgres and Python versions | |
- odoo_version: "16.0" | |
platforms: "linux/amd64,linux/arm64" | |
- odoo_version: "15.0" | |
platforms: "linux/amd64" | |
env: | |
# Indicates what's the equivalent to cmwedding-it/doodba:latest image | |
LATEST_RELEASE: "16.0" | |
DOCKER_REPO: cmwedding-it/doodba | |
steps: | |
- name: Set build date | |
run: echo "BUILD_DATE=$(date '+%Y-%m-%dT%H:%M:%S.%N%:z')" >> $GITHUB_ENV | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Check out to doodba source | |
uses: actions/checkout@v2 | |
with: | |
repository: Tecnativa/doodba | |
path: src | |
- name: Move custom dockerfiles to src | |
run: mv *.Dockerfile src/ | |
- name: Patch pip installer to allow caching | |
run: | | |
sed -i -E 's/^ _install_command = \["pip", "install", "--no-cache-dir", "-r"\]$/ _install_command = \["pip", "install", "-r"\]/' src/lib/doodbalib/installer.py | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
if: github.repository == 'tecnativa/doodba' && github.ref == 'refs/heads/master' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: oskardotglobal | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push base | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./src | |
file: ./src/${{ matrix.odoo_version }}.Dockerfile | |
platforms: ${{ matrix.platforms }} | |
tags: | | |
ghcr.io/${{ env.DOCKER_REPO }}${{ env.DOCKER_REPO_SUFFIX }}:${{ matrix.odoo_version }} | |
${{ matrix.odoo_version == env.LATEST_RELEASE && format('ghcr.io/{1}{2}:latest', env.DOCKER_REPO, env.DOCKER_REPO_SUFFIX) || '' }} | |
build-args: | | |
VCS_REF=${{ github.sha }} | |
BUILD_DATE=${{ env.BUILD_DATE }} | |
ODOO_VERSION=${{ matrix.odoo_version }} | |
- name: Build and push onbuild | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./onbuild.Dockerfile | |
platforms: ${{ matrix.platforms }} | |
tags: | | |
ghcr.io/${{ env.DOCKER_REPO }}${{ env.DOCKER_REPO_SUFFIX }}:${{ matrix.odoo_version }}-onbuild | |
${{ matrix.odoo_version == env.LATEST_RELEASE && format('ghcr.io/{1}{2}:latest-onbuild', env.DOCKER_REPO, env.DOCKER_REPO_SUFFIX) || '' }} | |
build-args: | | |
VCS_REF=${{ github.sha }} | |
BUILD_DATE=${{ env.BUILD_DATE }} | |
ODOO_VERSION=${{ matrix.odoo_version }} | |