This commit is contained in:
2025-07-03 20:08:27 -05:00
parent 7bde7e60c9
commit c5bbd1694e
4 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,30 @@
name: Build and push container image
run-name: ${{ gitea.actor }} is building and pushing container image
on: create
env:
GITEA_DOMAIN: git.tesseslanguage.com
GITEA_REGISTRY_USER: tesses50
RESULT_IMAGE_NAME: tesses50/test-app
jobs:
build-and-push-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ${{ env.GITEA_DOMAIN }}
username: ${{ env.GITEA_REGISTRY_USER }}
password: ${{ secrets. }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.GITEA_DOMAIN }}/${{ env.RESULT_IMAGE_NAME }}:${{ gitea.ref }}

11
Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM ubuntu:latest AS builder
WORKDIR /src
RUN apt update -y && apt install -y gcc
COPY main.c main.c
RUN gcc -o main main.c
FROM ubuntu:latest
WORKDIR /
COPY --from=builder /src/main /usr/local/bin/main

View File

7
main.c Normal file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
int main(int argc,char** argv)
{
printf("42\n");
return 0;
}