Skip to content
Snippets Groups Projects
Commit 303af699 authored by Quang tru HUYNH's avatar Quang tru HUYNH
Browse files

first commit

parents
No related branches found
No related tags found
No related merge requests found
name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
schedule:
- cron: '31 0 * * *'
push:
branches: [ main ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ main ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
image: registry-gitlab.pasteur.fr/dsi-tools/docker-images/docker:latest
services:
- registry-gitlab.pasteur.fr/dsi-tools/docker-images/docker:dind
stages:
- build
build:
stage: build
script:
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" registry-gitlab.pasteur.fr
- export MY_TIME=`date +"%F-%H%M"`
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME" -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" -t "$CI_REGISTRY_IMAGE:latest" -t "$CI_REGISTRY_IMAGE:$MY_TIME" .
- docker push "$CI_REGISTRY_IMAGE"
FROM archlinux
MAINTAINER Tru Huynh <tru@pasteur.fr>
RUN pacman -Syu
RUN date +"%Y-%m-%d-%H%M" > /last_update
This diff is collapsed.
# building a archlinux docker image for CI
Tru <tru@pasteur.fr>
(toy) docker image produced available at `registry-gitlab.pasteur.fr/tru/docker-archlinux-ci:latest`
github mirror created at https://github.com/truatpasteurdotfr/docker-archlinux-ci
github actions is now building docker image available at `ghcr.io/truatpasteurdotfr/docker-archlinux-ci:main`
(but within the "free" plan limits listed at https://github.com/features/packages#pricing)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment