Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile from the local source code #61

Merged
merged 7 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 12 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,15 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- run: make build run
- uses: actions/[email protected]
- uses: redhat-actions/[email protected]
with:
image: localhost/vlmcsd
tags: latest
containerfiles: ./Dockerfile
- run: podman run --rm localhost/vlmcsd:latest -V
- name: Run and test containers
run: |
podman run -d --name vlmcsd localhost/vlmcsd:latest
podman exec vlmcsd /usr/bin/vlmcs 0.0.0.0:1688
podman rm -f vlmcsd
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
name: update-bot
name: Release

on:
schedule:
- cron: "30 23 * * *"
push:
tags: ["*"]
workflow_dispatch:

jobs:
check:
runs-on: ubuntu-latest
outputs:
is_update: ${{ steps.check_ver.outputs.is_update }}
stable_ver: ${{ steps.check_ver.outputs.stable_ver }}
docker_tags: ${{ steps.check_ver.outputs.docker_tags }}
steps:
- name: Check version
id: check_ver
uses: mogeko/latest-version@master
with:
repo: Wind4/vlmcsd

build:
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.is_update == 'true'
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.2
- name: Log in to Docker Hub
uses: redhat-actions/[email protected]
with:
Expand All @@ -47,9 +32,6 @@ jobs:
images: |
docker.io/${{ secrets.DOCKER_USERNAME }}/vlmcsd
ghcr.io/${{ github.actor }}/vlmcsd
tags: |
type=schedule,pattern={{date 'YYYYMMDD'}}
${{ needs.check.outputs.docker_tags }}
- name: Setup QEMU
uses: docker/[email protected]
with:
Expand All @@ -58,12 +40,12 @@ jobs:
uses: redhat-actions/[email protected]
id: build-image
with:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
containerfiles: ./Dockerfile
build-args: |
VERSION=${{ needs.check.outputs.stable_ver }}
VLMCSD_VERSION=${{ github.ref_name }}
layers: false
- name: Push to Container registry
uses: redhat-actions/[email protected]
Expand Down
59 changes: 59 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,62 @@ Temporary Items
*.icloud

# End of https://www.toptal.com/developers/gitignore/api/Macos

# C
# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

# Build output
vlmcsd-1113/bin/
vlmcsd-1113/build/
vlmcsd-1113/lib/
24 changes: 13 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
FROM docker.io/library/debian:12 as builder
FROM docker.io/library/debian:12 AS builder

ARG VERSION=svn1113

ENV DEBIAN_FRONTEND=noninteractive
ARG DEBIAN_FRONTEND="noninteractive"
RUN apt-get update && apt-get -y install \
build-essential ca-certificates clang && \
rm -rf /var/lib/apt/lists/*

WORKDIR /opt/source
COPY ./vlmcsd-*/etc /opt/vlmcsd/etc
COPY ./vlmcsd-*/src /opt/vlmcsd/src
COPY ./vlmcsd-*/GNUmakefile /opt/vlmcsd/GNUmakefile
COPY ./vlmcsd-*/Makefile /opt/vlmcsd/Makefile

ADD https://github.com/Wind4/vlmcsd/archive/${VERSION}.tar.gz /tmp
RUN tar -xzf /tmp/${VERSION}.tar.gz --strip-components=1 && \
CC="clang" make vlmcsd vlmcs -j$(nproc)
ARG VLMCSD_VERSION="private\ build"
ARG CC="clang"
ENV CC="${CC}" VLMCSD_VERSION="${VLMCSD_VERSION}"
RUN make -C /opt/vlmcsd -j$(nproc)

FROM gcr.io/distroless/base-nossl-debian12:nonroot

LABEL org.opencontainers.image.description="A rootless container running vlmcsd"
LABEL org.opencontainers.image.author="Zheng Junyi <[email protected]>"
LABEL org.opencontainers.image.licenses="MIT"

COPY --from=builder /opt/source/bin/vlmcsd /usr/bin/vlmcsd
COPY --from=builder /opt/source/etc /etc/vlmcsd
COPY --from=builder /opt/vlmcsd/bin/vlmcsd /usr/bin/vlmcsd
COPY --from=builder /opt/vlmcsd/etc /etc/vlmcsd

EXPOSE 1688/tcp

ENTRYPOINT [ "/usr/bin/vlmcsd" ]
CMD [ "-D", "-d", "-e" ]

COPY --from=builder /opt/source/bin/vlmcs /usr/bin/vlmcs
COPY --from=builder /opt/vlmcsd/bin/vlmcs /usr/bin/vlmcs
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD [ "/usr/bin/vlmcs", "0.0.0.0:1688" ]
26 changes: 0 additions & 26 deletions Makefile

This file was deleted.

Loading