Skip to content
Snippets Groups Projects
Commit 74c627bb authored by Jairo Llopis's avatar Jairo Llopis Committed by Jairo Llopis
Browse files

Fix build

- Update labels to match those from https://github.com/opencontainers/image-spec/blob/master/annotations.md#pre-defined-annotation-keys
- Add missing build args.
- Remove unneeded python (which was failing to install, BTW) from the image.
- Remove `hooks` folder, which was used to build the image automatically in the Docker Hub. It's done in GitHub Actions now.
parent 144ea28c
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,8 @@ jobs: ...@@ -29,6 +29,8 @@ jobs:
env: env:
DOCKER_REPO: tecnativa/docker-socket-proxy DOCKER_REPO: tecnativa/docker-socket-proxy
steps: steps:
- name: Get date
run: echo "BUILD_DATE=$(date --rfc-3339 ns)" >> $GITHUB_ENV
# Prepare Docker environment and build # Prepare Docker environment and build
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1 - uses: docker/setup-qemu-action@v1
...@@ -37,6 +39,9 @@ jobs: ...@@ -37,6 +39,9 @@ jobs:
- name: Build image(s) - name: Build image(s)
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
VCS_REF=${{ github.sha }}
context: . context: .
file: ./Dockerfile file: ./Dockerfile
# HACK: Build single platform image for testing. See https://github.com/docker/buildx/issues/59 # HACK: Build single platform image for testing. See https://github.com/docker/buildx/issues/59
...@@ -93,6 +98,9 @@ jobs: ...@@ -93,6 +98,9 @@ jobs:
'refs/heads/master' 'refs/heads/master'
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
VCS_REF=${{ github.sha }}
context: . context: .
file: ./Dockerfile file: ./Dockerfile
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm/v8,linux/arm64,linux/ppc64le,linux/s390x platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm/v8,linux/arm64,linux/ppc64le,linux/s390x
......
ARG REPO=library FROM haproxy:1.9-alpine
FROM ${REPO}/haproxy:1.9-alpine
EXPOSE 2375 EXPOSE 2375
ENV ALLOW_RESTARTS=0 \ ENV ALLOW_RESTARTS=0 \
...@@ -29,17 +28,11 @@ ENV ALLOW_RESTARTS=0 \ ...@@ -29,17 +28,11 @@ ENV ALLOW_RESTARTS=0 \
VOLUMES=0 VOLUMES=0
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
# Install python/pip
ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache python3 && ln -sf $(which python3) /usr/local/bin/python
RUN python -m ensurepip && python -m pip install --no-cache --upgrade pip setuptools
# Metadata # Metadata
ARG VCS_REF ARG VCS_REF
ARG BUILD_DATE ARG BUILD_DATE
LABEL org.label-schema.schema-version="1.0" \ LABEL org.opencontainers.image.vendor=Tecnativa \
org.label-schema.vendor=Tecnativa \ org.opencontainers.image.licenses=Apache-2.0 \
org.label-schema.license=Apache-2.0 \ org.opencontainers.image.created="$BUILD_DATE" \
org.label-schema.build-date="$BUILD_DATE" \ org.opencontainers.image.revision="$VCS_REF" \
org.label-schema.vcs-ref="$VCS_REF" \ org.opencontainers.image.source="https://github.com/Tecnativa/docker-socket-proxy"
org.label-schema.vcs-url="https://github.com/Tecnativa/docker-socket-proxy"
#!/bin/bash
set -ex
# Extract arch repo from a docker tag suffix
REPO=""
case "$DOCKER_TAG" in
*amd64)
REPO="library"
;;
*arm32v5)
REPO="arm32v5"
;;
*arm32v6)
REPO="arm32v6"
;;
*arm32v7)
REPO="arm32v7"
;;
*arm64v8)
REPO="arm64v8"
;;
*i386)
REPO="i386"
;;
*ppc64le)
REPO="ppc64le"
;;
*s390x)
REPO="s390x"
;;
*)
REPO="library"
;;
esac
docker build \
--build-arg REPO="$REPO" \
--build-arg VCS_REF="$GIT_SHA1" \
--build-arg BUILD_DATE="$(date --rfc-3339 ns)" \
--tag "$IMAGE_NAME" .
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment