Update Dockerfile with labels. Update gitlab-ci for registry usage
authorjp <jp+pleroma@supplntr.io>
Fri, 10 Jan 2020 19:09:14 +0000 (14:09 -0500)
committerjp <jp+pleroma@supplntr.io>
Fri, 10 Jan 2020 19:09:14 +0000 (14:09 -0500)
.gitlab-ci.yml
Dockerfile

index dc85eaba21338e19be41f4b88987698b00e4c6a2..b34c7e98d524fdebd8cb17a35bd96b46050a59fc 100644 (file)
@@ -6,18 +6,24 @@ variables: &global_variables
   POSTGRES_PASSWORD: postgres
   DB_HOST: postgres
   MIX_ENV: test
+  DOCKER_DRIVER: overlay2
+  DOCKER_HOST: unix:///var/run/docker.sock
+  DOCKER_IMAGE: $CI_REGISTRY_IMAGE:latest
+  DOCKER_IMAGE_SHA: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
 
 cache: &global_cache_policy
   key: ${CI_COMMIT_REF_SLUG}
   paths:
-          - deps
-          - _build
+    - deps
+    - _build
+
 stages:
   - build
   - test
   - benchmark
   - deploy
   - release
+  - docker
 
 before_script:
   - mix local.hex --force
@@ -264,3 +270,20 @@ arm64-musl:
   variables: *release-variables
   before_script: *before-release-musl
   script: *release
+
+docker:
+  stage: docker
+  image: docker:latest
+  tags:
+    - dind
+  before_script: &before-docker
+    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+    - export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
+    - export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
+  script:
+    - docker pull $DOCKER_IMAGE || true
+    - docker build --cache-from $DOCKER_IMAGE --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $DOCKER_IMAGE_SHA -t $DOCKER_IMAGE .
+    - docker push $DOCKER_IMAGE_SHA
+    - docker push $DOCKER_IMAGE
+  only:
+    - develop
index c61dcfde91251915289159b6663fe51b944c2bd9..4f7f127168da21240e47e18e3635d3d11d021b0c 100644 (file)
@@ -14,6 +14,20 @@ RUN apk add git gcc g++ musl-dev make &&\
 
 FROM alpine:3.9
 
+ARG BUILD_DATE
+ARG VCS_REF
+
+LABEL maintainer="ops@pleroma.social" \
+    org.opencontainers.image.title="pleroma" \
+    org.opencontainers.image.description="Pleroma for Docker" \
+    org.opencontainers.image.authors="ops@pleroma.social" \
+    org.opencontainers.image.vendor="pleroma.social" \
+    org.opencontainers.image.documentation="https://git.pleroma.social/pleroma/pleroma" \
+    org.opencontainers.image.licenses="AGPL-3.0" \
+    org.opencontainers.image.url="https://pleroma.social" \
+    org.opencontainers.image.revision=$VCS_REF \
+    org.opencontainers.image.created=$BUILD_DATE
+
 ARG HOME=/opt/pleroma
 ARG DATA=/var/lib/pleroma