Skip to content

Commit 016d1b2

Browse files
authored
Merge pull request #7 from edquist/SOFTWARE-5154.docker
Build docker container (SOFTWARE-5154)
2 parents 06eb1de + e315e9b commit 016d1b2

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build and Push Docker image
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
repository_dispatch:
7+
types:
8+
- dispatch-build
9+
workflow_dispatch:
10+
11+
jobs:
12+
make-date-tag:
13+
runs-on: ubuntu-latest
14+
if: startsWith(github.repository, 'opensciencegrid/')
15+
outputs:
16+
dtag: ${{ steps.mkdatetag.outputs.dtag }}
17+
steps:
18+
- name: make date tag
19+
id: mkdatetag
20+
run: echo "::set-output name=dtag::$(date +%Y%m%d-%H%M)"
21+
22+
build:
23+
runs-on: ubuntu-latest
24+
needs: [make-date-tag]
25+
if: startsWith(github.repository, 'opensciencegrid/')
26+
steps:
27+
- uses: actions/checkout@v2
28+
29+
- name: Generate tag list
30+
id: generate-tag-list
31+
env:
32+
TIMESTAMP: ${{ needs.make-date-tag.outputs.dtag }}
33+
run: |
34+
#docker_repo=${GITHUB_REPOSITORY/opensciencegrid\/docker-/opensciencegrid/}
35+
docker_repo=opensciencegrid/comanage-utils
36+
tag_list=()
37+
for registry in docker.io hub.opensciencegrid.org; do
38+
for image_tag in "latest" "latest-$TIMESTAMP"; do
39+
tag_list+=("$registry/$docker_repo":"$image_tag")
40+
done
41+
done
42+
# This causes the tag_list array to be comma-separated below,
43+
# which is required for build-push-action
44+
IFS=,
45+
echo "::set-output name=taglist::${tag_list[*]}"
46+
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v1
49+
50+
- name: Log in to Docker Hub
51+
uses: docker/login-action@v1
52+
with:
53+
username: ${{ secrets.DOCKER_USERNAME }}
54+
password: ${{ secrets.DOCKER_PASSWORD }}
55+
56+
- name: Log in to OSG Harbor
57+
uses: docker/login-action@v1
58+
with:
59+
registry: hub.opensciencegrid.org
60+
username: ${{ secrets.OSG_HARBOR_ROBOT_USER }}
61+
password: ${{ secrets.OSG_HARBOR_ROBOT_PASSWORD }}
62+
63+
- name: Build and push Docker images
64+
uses: docker/[email protected]
65+
with:
66+
context: .
67+
push: true
68+
tags: "${{ steps.generate-tag-list.outputs.taglist }}"
69+

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM library/python:3.7-alpine
2+
3+
LABEL maintainer OSG Software <[email protected]>
4+
5+
COPY *.py /usr/local/bin/
6+

create_project.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import sys
66
import json
77
import getopt
8-
import collections
98
import urllib.error
109
import urllib.request
1110

0 commit comments

Comments
 (0)