Skip to content

feat: add TLS support #40

feat: add TLS support

feat: add TLS support #40

Workflow file for this run

name: Build OCI Image
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
permissions:
contents: none
jobs:
build:
name: Build ${{ matrix.variant.name }} image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
variant:
- name: Alpine
tag: alpine
dockerfile: Dockerfile.alpine
- name: Ubuntu
tag: ubuntu
dockerfile: Dockerfile
steps:
- name: Check out code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Login to GHCR
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
if: ${{ github.event_name != 'pull_request' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Set up Docker Metadata
id: meta
uses: docker/metadata-action@dbef88086f6cef02e264edb7dbf63250c17cef6c # v5.5.0
with:
images: ghcr.io/${{ github.repository }}
flavor: |
latest=auto
prefix=${{ matrix.variant.tag }}-,onlatest=true
tags: |
type=edge
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
with:
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=gha,scope=${{ matrix.variant.tag }}
cache-to: type=gha,mode=max,scope=${{ matrix.variant.tag }}
context: .
file: ${{ matrix.variant.dockerfile }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
devcontainer:
name: Build devcontainer image
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Check changed files
id: changes
run: |
if [ '${{ github.event_name }}' = 'pull_request' ]; then
base="${{ github.event.pull_request.base.sha }}"
head="${{ github.event.pull_request.head.sha }}"
path=".devcontainer"
changes="$(git diff --name-only "${base}" "${head}" -- "${path}" || true)"
if [ -n "${changes}" ]; then
echo needs_build=true >> "${GITHUB_OUTPUT}"
else
echo needs_build=false >> "${GITHUB_OUTPUT}"
fi
else
echo needs_build=true >> "${GITHUB_OUTPUT}"
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
if: steps.changes.outputs.needs_build == 'true'
- name: Install @devcontainers/cli
run: npm install -g @devcontainers/cli
if: steps.changes.outputs.needs_build == 'true'
- name: Build image
run: devcontainer build --workspace-folder . --output type=image
if: steps.changes.outputs.needs_build == 'true'