|
| 1 | +# Copyright © 2020 Red Hat, Inc. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +FROM registry.centos.org/centos:8 AS build |
| 16 | +USER root |
| 17 | +WORKDIR /work |
| 18 | + |
| 19 | +# Speed up build by leveraging docker layer caching |
| 20 | +COPY go.mod go.sum vendor/ ./ |
| 21 | +RUN mkdir -p bin |
| 22 | + |
| 23 | +RUN dnf install -y --disableplugin=subscription-manager \ |
| 24 | + --enablerepo=powertools \ |
| 25 | + golang make libsemanage-devel |
| 26 | + |
| 27 | +ADD . /work |
| 28 | + |
| 29 | +RUN make |
| 30 | + |
| 31 | +FROM registry.centos.org/centos:8 AS build |
| 32 | +# TODO(jaosorior): Switch to UBI once we use static linking |
| 33 | +#FROM registry.access.redhat.com/ubi8/ubi-minimal:latest |
| 34 | + |
| 35 | +# TODO(jaosorior): See if we can run this without root |
| 36 | +USER root |
| 37 | + |
| 38 | +LABEL name="selinuxd" \ |
| 39 | + description="selinuxd is a daemon that listens for files in /etc/selinux.d/ and installs the relevant policies." |
| 40 | + |
| 41 | +# TODO(jaosorior): Remove once we use static linking |
| 42 | +RUN dnf install -y --disableplugin=subscription-manager \ |
| 43 | + --enablerepo=powertools \ |
| 44 | + policycoreutils |
| 45 | + |
| 46 | +COPY --from=build /work/bin/selinuxdctl /usr/bin/ |
| 47 | + |
| 48 | +ENTRYPOINT ["/usr/bin/selinuxdctl"] |
0 commit comments