forked from pymc-devs/pymc
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 1.79 KB
/
devcontainer-docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: devcontainer-docker-image
on:
workflow_dispatch:
schedule:
- cron: "48 19 * * 5" # Fridays at 19:48 UTC
release:
types: [published]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-devcontainer # pymc-devs/pymc-devcontainer
jobs:
build-container:
runs-on: ubuntu-latest
# Set permissions for GitHub token
# <https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#authenticating-to-package-registries-on-github>
permissions:
contents: read
packages: write
steps:
- name: Checkout source
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Setup Docker buildx
uses: docker/[email protected]
- name: Prepare metadata
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,enable=true,prefix=git-
type=raw,value=latest
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c
with:
context: .
file: scripts/dev.Dockerfile
platforms: linux/amd64 # ,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-to: type=inline