Skip to content

Commit

Permalink
Add docker labels and a makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Dec 12, 2020
1 parent 84a3772 commit 5883085
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[Makefile]
indent_style = tab
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Build action image
run: docker build ./docker
run: make docker-build
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.PHONY: update-tags docker-build

docker-build:
docker build ./docker \
--build-arg VCS_REF=`git rev-parse HEAD` \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`

update-tags:
git checkout main
git tag -s -f -a -m "latest series" latest
git checkout -
git checkout 5.x
git tag -s -f -a -m "5.x series" 5.x
git checkout -
git push origin latest -f
git push origin 5.x -f
15 changes: 15 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@ FROM php:cli-alpine

ARG RELEASE_VERSION=latest

# Metadata params
ARG VCS_REF
ARG BUILD_DATE

COPY entrypoint.sh /entrypoint.sh

ADD https://doctum.long-term.support/releases/${RELEASE_VERSION}/doctum.phar /bin/doctum

RUN echo "Downloaded release version: ${RELEASE_VERSION}" && chmod +x /bin/doctum && php /bin/doctum --version

# Metadata
LABEL org.label-schema.vendor="Sudo-Bot" \
org.label-schema.url="https://github.com/sudo-bot/action-doctum#readme" \
org.label-schema.name="Doctum action" \
org.label-schema.description="Doctum action for GitHub actions" \
org.label-schema.version=${RELEASE_VERSION} \
org.label-schema.vcs-url="https://github.com/sudo-bot/action-doctum.git" \
org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.docker.schema-version="1.0"

ENTRYPOINT ["/entrypoint.sh"]
5 changes: 5 additions & 0 deletions docker/hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
# $IMAGE_NAME var is injected into the build so the tag is correct.
docker build --build-arg VCS_REF=`git rev-parse HEAD` \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
-t $IMAGE_NAME .

0 comments on commit 5883085

Please sign in to comment.