Skip to content

Commit 9a75816

Browse files
committed
Merge remote-tracking branch 'refs/remotes/github/main'
2 parents b42821a + fc64437 commit 9a75816

File tree

3 files changed

+129
-0
lines changed

3 files changed

+129
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git/
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Docker
2+
3+
# This workflow uses actions that are not certified by GitHub.
4+
# They are provided by a third-party and are governed by
5+
# separate terms of service, privacy policy, and support
6+
# documentation.
7+
8+
on:
9+
# schedule:
10+
# - cron: '41 14 * * *'
11+
push:
12+
branches: [ "main" ]
13+
# Publish semver tags as releases.
14+
tags: [ 'v*.*.*' ]
15+
# pull_request:
16+
# branches: [ "main" ]
17+
workflow_dispatch: {}
18+
19+
env:
20+
# Use docker.io for Docker Hub if empty
21+
REGISTRY: ghcr.io
22+
# github.repository as <account>/<repo>
23+
IMAGE_NAME: ${{ github.repository }}
24+
25+
26+
jobs:
27+
build:
28+
29+
runs-on: ubuntu-latest
30+
permissions:
31+
contents: read
32+
packages: write
33+
# This is used to complete the identity challenge
34+
# with sigstore/fulcio when running outside of PRs.
35+
id-token: write
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
41+
# Install the cosign tool except on PR
42+
# https://github.com/sigstore/cosign-installer
43+
- name: Install cosign
44+
if: github.event_name != 'pull_request'
45+
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
46+
with:
47+
cosign-release: 'v2.2.4'
48+
49+
# Set up BuildKit Docker container builder to be able to build
50+
# multi-platform images and export cache
51+
# https://github.com/docker/setup-buildx-action
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
54+
55+
# Login against a Docker registry except on PR
56+
# https://github.com/docker/login-action
57+
- name: Log into registry ${{ env.REGISTRY }}
58+
if: github.event_name != 'pull_request'
59+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
60+
with:
61+
registry: ${{ env.REGISTRY }}
62+
username: ${{ github.actor }}
63+
password: ${{ secrets.GITHUB_TOKEN }}
64+
65+
# Extract metadata (tags, labels) for Docker
66+
# https://github.com/docker/metadata-action
67+
- name: Extract Docker metadata
68+
id: meta
69+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
70+
with:
71+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
72+
73+
# Build and push Docker image with Buildx (don't push on PR)
74+
# https://github.com/docker/build-push-action
75+
- name: Build and push Docker image
76+
id: build-and-push
77+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
78+
with:
79+
context: .
80+
push: ${{ github.event_name != 'pull_request' }}
81+
tags: ${{ steps.meta.outputs.tags }}
82+
labels: ${{ steps.meta.outputs.labels }}
83+
cache-from: type=gha
84+
cache-to: type=gha,mode=max
85+
86+
# Sign the resulting Docker image digest except on PRs.
87+
# This will only write to the public Rekor transparency log when the Docker
88+
# repository is public to avoid leaking data. If you would like to publish
89+
# transparency data even for private images, pass --force to cosign below.
90+
# https://github.com/sigstore/cosign
91+
- name: Sign the published Docker image
92+
if: ${{ github.event_name != 'pull_request' }}
93+
env:
94+
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
95+
TAGS: ${{ steps.meta.outputs.tags }}
96+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
97+
# This step uses the identity token to provision an ephemeral certificate
98+
# against the sigstore community Fulcio instance.
99+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM python:3.12-slim
4+
5+
LABEL org.opencontainers.image.source=https://github.com/juaml/junifer-data
6+
LABEL org.opencontainers.image.description="Junifer data container image"
7+
LABEL org.opencontainers.image.licenses=AGPL-3.0-only
8+
9+
RUN apt-get update && apt-get install -y \
10+
git \
11+
git-annex \
12+
&& rm -rf /var/lib/apt/lists/*
13+
14+
# Install datalad
15+
RUN --mount=type=cache,target=/cache/pip \
16+
PIP_CACHE_DIR=/cache/pip \
17+
python -m pip install datalad
18+
19+
# Configure git so that datalad doesn't give warnings
20+
RUN git config --global user.email "[email protected]" && \
21+
git config --global user.name "Docker User"
22+
23+
# Clean apt cache
24+
RUN apt-get autoremove --purge && apt-get clean
25+
26+
# Get all data
27+
RUN datalad clone https://github.com/juaml/junifer-data.git /opt/junifer-data && \
28+
cd /opt/junifer-data && \
29+
datalad get .

0 commit comments

Comments
 (0)