Go to file
Fabian Vogt d31f24723b Accepting request 907914 from home:brunoleon:branches:openSUSE:Tools
- Improve regexp instead of having two as proposed by Fabian Vogt

- Retain compatibility with old syntax. Update documentation.

- Use entry/exit point to determine whether labels should be expanded.
  Doing so makes the Dockerfile compatible with standard
  docker build command.

OBS-URL: https://build.opensuse.org/request/show/907914
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-docker_label_helper?expand=0&rev=3
2021-07-23 09:50:31 +00:00
.gitattributes Accepting request 833745 from home:favogt:dockerfilemeta 2020-09-17 13:35:39 +00:00
.gitignore Accepting request 833745 from home:favogt:dockerfilemeta 2020-09-17 13:35:39 +00:00
docker_label_helper Accepting request 907914 from home:brunoleon:branches:openSUSE:Tools 2021-07-23 09:50:31 +00:00
docker_label_helper.service Accepting request 907914 from home:brunoleon:branches:openSUSE:Tools 2021-07-23 09:50:31 +00:00
obs-service-docker_label_helper.changes Accepting request 907914 from home:brunoleon:branches:openSUSE:Tools 2021-07-23 09:50:31 +00:00
obs-service-docker_label_helper.spec Accepting request 907914 from home:brunoleon:branches:openSUSE:Tools 2021-07-23 09:50:31 +00:00
README Accepting request 907914 from home:brunoleon:branches:openSUSE:Tools 2021-07-23 09:50:31 +00:00
test.sh Accepting request 907914 from home:brunoleon:branches:openSUSE:Tools 2021-07-23 09:50:31 +00:00

obs-service-docker_label_helper
===============================

This service can be enabled to run during buildtime, when it will edit the
Dockerfile to expand the LABEL instruction.

A new syntax using entry/exit flags has been introduced to provide
compatibility with stock docker build command while allowing OBS
to add its prefix to existing LABEL instructions values.

Both new and old syntax are supported, but you should not mix both in the
same Dockerfile.

1 - New syntax using entry/exit flags

Only LABEL between # labelprefix and # endlabelprefix will be considered

Example:

```
FROM opensuse/tumbleweed
# labelprefix=org.opensuse.nano
LABEL org.opencontainers.image.title="Example container"
LABEL org.opencontainers.image.description="This contains nano"
# endlabelprefix
LABEL not.expanded.label="example
```

expands to

```
FROM opensuse/tumbleweed
LABEL org.opensuse.nano.title="Example container"
LABEL org.opencontainers.image.title="Example container"
LABEL org.opensuse.nano.description="This contains nano"
LABEL org.opencontainers.image.description="This contains nano"
LABEL not.expanded.label="example"
```

2 - Old syntax

Expand the PREFIXEDLABEL instruction.

Example:

```
FROM opensuse/tumbleweed
# labelprefix=org.opensuse.nano
PREFIXEDLABEL org.opencontainers.image.title="Example container"
PREFIXEDLABEL org.opencontainers.image.description="This contains nano"
```

expands to

```
FROM opensuse/tumbleweed
LABEL org.opensuse.nano.title="Example container"
LABEL org.opencontainers.image.title="Example container"
LABEL org.opensuse.nano.description="This contains nano"
LABEL org.opencontainers.image.description="This contains nano"
```