feat: add docker for tests
This commit is contained in:
parent
f5df7f038e
commit
44d285465d
67
.gitea/workflows/docker.yaml
Normal file
67
.gitea/workflows/docker.yaml
Normal file
@ -0,0 +1,67 @@
|
||||
name: Build and push docker image
|
||||
run-name: Building docker image and push them to git.dacremont.xyz
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
paths:
|
||||
- 'Dockerfile'
|
||||
# Publish semver tags as releases.
|
||||
tags: [ 'v*.*.*' ]
|
||||
|
||||
|
||||
env:
|
||||
# Use docker.io for Docker Hub if empty
|
||||
REGISTRY: git.dacremont.xyz
|
||||
# gitea.repository as <account>/<repo>
|
||||
IMAGE_NAME: ${{ gitea.repository }}
|
||||
|
||||
|
||||
jobs:
|
||||
Build-and-push-docker:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
# This is used to complete the identity challenge
|
||||
# with sigstore/fulcio when running outside of PRs.
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Set up BuildKit Docker container builder to be able to build
|
||||
# multi-platform images and export cache
|
||||
# https://`.com/docker/setup-buildx-action
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0`
|
||||
|
||||
- name: Restore Docker cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ gitea.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
# Login against a Docker registry except on PR
|
||||
# https://`.com/docker/login-action
|
||||
- name: Log into registry ${{ env.REGISTRY }}
|
||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.username }}
|
||||
password: ${{ secrets.TOKEN }}
|
||||
|
||||
- name: Build and push docker image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }}
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||
|
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM alpine:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk update && apk add docker
|
||||
|
||||
ENTRYPOINT [ "/bin/sh" ]
|
Loading…
x
Reference in New Issue
Block a user