Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
identw committed Jun 19, 2024
0 parents commit 2e060b6
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
38 changes: 38 additions & 0 deletions .github/workflows/latest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: container build latest
on:
workflow_run:
workflows: ["Test"]
branches: [main]
types:
- completed

jobs:
container_image:
name: container_image
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@main
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@master
- name: image name
id: set-image-name
run: |
name="$(echo ${{ github.repository }} | tr 'A-Z' 'a-z')"
echo "image=ghcr.io/$name:latest" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@master
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@master
with:
context: .
push: true
tags: ${{ steps.set-image-name.outputs.image }}
cache-from: type=gha
cache-to: type=gha,mode=max
61 changes: 61 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: release
concurrency:
group: release
cancel-in-progress: true
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
jobs:
container_image:
name: container_image
runs-on: ubuntu-latest
outputs:
image: ${{ steps.set-image-name.outputs.image }}
steps:
- name: Checkout code
uses: actions/checkout@main
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@master
- name: image name
id: set-image-name
run: |
name="$(echo ${{ github.repository }} | tr 'A-Z' 'a-z')"
echo "image=ghcr.io/$name:${{ github.ref_name }}" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@master
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@master
with:
context: .
push: true
tags: ${{ steps.set-image-name.outputs.image }}
cache-from: type=gha
cache-to: type=gha,mode=max

release:
name: release
runs-on: ubuntu-latest
needs: [container_image]
steps:
- name: download cache-artifacts
uses: actions/cache/restore@main
with:
path: ./artifacts
key: artifacts

- name: ${{ github.ref_name }}
uses: softprops/action-gh-release@v2
with:
body: |
container image:
```
${{ needs.container_image.outputs.image }}
```
files: |
./artifacts/*
23 changes: 23 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test
on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@main

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@master

- name: Build container
uses: docker/build-push-action@master
with:
context: .
push: false
tags: test
cache-from: type=gha
cache-to: type=gha,mode=max
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM docker.io/nginx:1.27.0-alpine3.19-slim as copy

FROM docker.io/alpine:3.20.0 as settings
RUN apk --no-cache add libcap
COPY --from=copy /usr/sbin/nginx /usr/sbin/nginx
RUN setcap cap_net_bind_service+ep /usr/sbin/nginx

FROM docker.io/nginx:1.27.0-alpine3.19-slim
COPY --from=settings /usr/sbin/nginx /usr/sbin/nginx


0 comments on commit 2e060b6

Please sign in to comment.