mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 03:26:45 +00:00
Adjust docker labels to modern OCI schema (#7773)
* adapt namespace * add new labels * make baseimage available for labels * remove unneeded ending * ensure image name is correct for ghcrio * ensure the right outputs are used * fix reference * fix assigment * only push docker reg image if authd * swith back to env this gets provided by the version ci script * make repo targets changeable * make readable * revert ghcr.io change
This commit is contained in:
parent
6cf56845e2
commit
41f6dd69b8
6
.github/scripts/version_check.py
vendored
6
.github/scripts/version_check.py
vendored
@ -10,6 +10,7 @@ tagged branch:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import itertools
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -198,10 +199,13 @@ if __name__ == '__main__':
|
|||||||
print(f"Version check passed for '{version}'!")
|
print(f"Version check passed for '{version}'!")
|
||||||
print(f"Docker tags: '{docker_tags}'")
|
print(f"Docker tags: '{docker_tags}'")
|
||||||
|
|
||||||
|
target_repos = [REPO.lower(), f'ghcr.io/{REPO.lower()}']
|
||||||
|
|
||||||
# Ref: https://getridbug.com/python/how-to-set-environment-variables-in-github-actions-using-python/
|
# Ref: https://getridbug.com/python/how-to-set-environment-variables-in-github-actions-using-python/
|
||||||
with open(os.getenv('GITHUB_ENV'), 'a') as env_file:
|
with open(os.getenv('GITHUB_ENV'), 'a') as env_file:
|
||||||
# Construct tag string
|
# Construct tag string
|
||||||
tags = ','.join([f'{REPO.lower()}:{tag}' for tag in docker_tags])
|
tag_list = [[f'{r}:{t}' for t in docker_tags] for r in target_repos]
|
||||||
|
tags = ','.join(itertools.chain(*tag_list))
|
||||||
|
|
||||||
env_file.write(f'docker_tags={tags}\n')
|
env_file.write(f'docker_tags={tags}\n')
|
||||||
|
|
||||||
|
4
.github/workflows/docker.yaml
vendored
4
.github/workflows/docker.yaml
vendored
@ -135,9 +135,9 @@ jobs:
|
|||||||
id: docker_login
|
id: docker_login
|
||||||
run: |
|
run: |
|
||||||
if [ -z "${{ secrets.DOCKER_USERNAME }}" ]; then
|
if [ -z "${{ secrets.DOCKER_USERNAME }}" ]; then
|
||||||
echo "skip_dockerhub_login=true" >> $GITHUB_ENV
|
echo "skip_dockerhub_login=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "skip_dockerhub_login=false" >> $GITHUB_ENV
|
echo "skip_dockerhub_login=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
- name: Login to Dockerhub
|
- name: Login to Dockerhub
|
||||||
if: github.event_name != 'pull_request' && steps.docker_login.outputs.skip_dockerhub_login != 'true'
|
if: github.event_name != 'pull_request' && steps.docker_login.outputs.skip_dockerhub_login != 'true'
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
ARG base_image=python:3.11-alpine3.18
|
ARG base_image=python:3.11-alpine3.18
|
||||||
FROM ${base_image} AS inventree_base
|
FROM ${base_image} AS inventree_base
|
||||||
|
ARG base_image
|
||||||
|
|
||||||
# Build arguments for this image
|
# Build arguments for this image
|
||||||
ARG commit_tag=""
|
ARG commit_tag=""
|
||||||
@ -48,13 +49,18 @@ ENV INVENTREE_BACKGROUND_WORKERS="4"
|
|||||||
ENV INVENTREE_WEB_ADDR=0.0.0.0
|
ENV INVENTREE_WEB_ADDR=0.0.0.0
|
||||||
ENV INVENTREE_WEB_PORT=8000
|
ENV INVENTREE_WEB_PORT=8000
|
||||||
|
|
||||||
LABEL org.label-schema.schema-version="1.0" \
|
LABEL org.opencontainers.image.created=${DATE} \
|
||||||
org.label-schema.build-date=${DATE} \
|
org.opencontainers.image.vendor="inventree" \
|
||||||
org.label-schema.vendor="inventree" \
|
org.opencontainers.image.title="InvenTree backend server" \
|
||||||
org.label-schema.name="inventree/inventree" \
|
org.opencontainers.image.description="InvenTree is the open-source inventory management system" \
|
||||||
org.label-schema.url="https://hub.docker.com/r/inventree/inventree" \
|
org.opencontainers.image.url="https://inventree.org" \
|
||||||
org.label-schema.vcs-url="https://github.com/inventree/InvenTree.git" \
|
org.opencontainers.image.documentation="https://docs.inventree.org" \
|
||||||
org.label-schema.vcs-ref=${commit_tag}
|
org.opencontainers.image.source="https://github.com/inventree/InvenTree" \
|
||||||
|
org.opencontainers.image.revision=${commit_hash} \
|
||||||
|
org.opencontainers.image.licenses="MIT" \
|
||||||
|
org.opencontainers.image.base.name="docker.io/library/${base_image}" \
|
||||||
|
org.opencontainers.image.version=${commit_tag}
|
||||||
|
|
||||||
|
|
||||||
# Install required system level packages
|
# Install required system level packages
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user