Update Dockerfile with labels. Update gitlab-ci for registry usage

This commit is contained in:
jp 2020-01-10 14:09:14 -05:00
parent 05ca420c09
commit 2ef8f0be6c
2 changed files with 39 additions and 2 deletions

View File

@ -6,18 +6,24 @@ variables: &global_variables
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
DB_HOST: postgres DB_HOST: postgres
MIX_ENV: test 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 cache: &global_cache_policy
key: ${CI_COMMIT_REF_SLUG} key: ${CI_COMMIT_REF_SLUG}
paths: paths:
- deps - deps
- _build - _build
stages: stages:
- build - build
- test - test
- benchmark - benchmark
- deploy - deploy
- release - release
- docker
before_script: before_script:
- mix local.hex --force - mix local.hex --force
@ -264,3 +270,20 @@ arm64-musl:
variables: *release-variables variables: *release-variables
before_script: *before-release-musl before_script: *before-release-musl
script: *release 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

View File

@ -14,6 +14,20 @@ RUN apk add git gcc g++ musl-dev make &&\
FROM alpine:3.9 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 HOME=/opt/pleroma
ARG DATA=/var/lib/pleroma ARG DATA=/var/lib/pleroma