moving ci/cd over to forgejo

This commit is contained in:
Nicholas Orlowsky 2025-02-04 13:26:54 -05:00
parent 0ebdb34601
commit 3c9edb1e0b
Signed by: nickorlow
GPG key ID: 838827D8C4611687
13 changed files with 57 additions and 29 deletions

View file

@ -1,15 +1,18 @@
name: Build and Publish Docker Image
name: Docker Build & Publish
on:
release:
types: [created]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
CTR_REGISTRY: git.nickorlow.com
IMAGE_NAME: "anthracite"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
@ -30,11 +33,11 @@ jobs:
echo Building with version number $RELEASE_VERSION
echo $RELEASE_VERSION > src/build/version.txt
- name: Log into registry ${{ env.REGISTRY }}
- name: Log into registry ${{ env.CTR_REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
registry: ${{ env.CTR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
@ -42,7 +45,7 @@ jobs:
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.CTR_REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
build/
build_supp/version.cpp
.cache/

View file

@ -15,23 +15,11 @@ add_custom_target(build-version
add_custom_target(build-supplemental
COMMAND cd ../build_supp && python3 ./error_gen.py
COMMAND cp -r ../www .
DEPENDS build_supp/version.txt www/* build_supp/error_gen.py build-version
COMMAND mkdir www && cp -r ../default_www/regular/* ./www/
DEPENDS build_supp/version.txt ../default_www/regular/* build_supp/error_gen.py build-version
COMMENT "Generated supplemental build files (default www dir + error pages)"
)
add_custom_target(lint
COMMAND clang-tidy *.cpp
)
add_custom_target(lint-fix
COMMAND clang-tidy *.cpp -fix -fix-errors
)
add_custom_target(build-docker
COMMAND docker build .. -t anthracite
)
add_custom_target(run
COMMAND anthracite-bin
DEPENDS anthracite-bin

View file

@ -1,14 +1,21 @@
FROM alpine as build-env
RUN apk add --no-cache build-base python3 cmake
COPY ./src/ .
RUN rm -rf CMakeCache.txt CMakeFiles
RUN cmake -DCMAKE_BUILD_TYPE=Release .
COPY ./src ./src
COPY ./lib ./lib
COPY ./default_www ./default_www
COPY ./build_supp ./build_supp
COPY ./CMakeLists.txt .
RUN mkdir build
WORKDIR build
RUN cmake -DCMAKE_BUILD_TYPE=Release ..
RUN make anthracite-bin
FROM alpine
RUN apk add --no-cache build-base
COPY --from=build-env /anthracite /anthracite
COPY --from=build-env /www /www
COPY --from=build-env /error_pages /error_pages
RUN apk add --no-cache libgcc libstdc++
COPY --from=build-env /build/anthracite-bin /anthracite-bin
COPY --from=build-env /build/error_pages /error_pages
COPY /default_www/docker /www
CMD ["/anthracite-bin"]

View file

@ -15,7 +15,7 @@ Create a `build/` directory, run `cmake ..`, and then `make` to build.
- [x] Multithreading
- [x] HTTP/1.1
- [x] Enhance logging
- [-] Build out module-based backend system for handling requests
- [x] Create library that can be used to implement custom backends (i.e. webapi, fileserver, etc)
- [ ] Faster parsing
- [ ] HTTP/2
- [ ] Improve benchmarking infrastructure

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

View file

@ -0,0 +1,9 @@
<head>
<title>Anthracite</title>
<link rel="icon" type="image/x-icon" href="/favicon.ico">
</head>
<center>
<h1>Anthracite is Running in Docker!</h1>
<p>If you are seeing this page, then Anthracite is configured correctly!</p>
<p>Add files to the "www" directory in your build step to begin serving your website.</p>
</center>

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

View file

@ -0,0 +1,9 @@
<head>
<title>Anthracite</title>
<link rel="icon" type="image/x-icon" href="/favicon.ico">
</head>
<center>
<h1>Anthracite is Running in Docker Compose!</h1>
<p>If you are seeing this page, then Anthracite is configured correctly!</p>
<p>Bind-mount a directory to "/www" to begin serving your website.</p>
</center>

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

View file

@ -1,6 +1,6 @@
<head>
<title>Anthracite</title>
<link rel="icon" type="image/x-icon" href="/images/favicon.ico">
<link rel="icon" type="image/x-icon" href="/favicon.ico">
</head>
<center>
<h1>Anthracite is Running!</h1>

9
docker-compose.yml Normal file
View file

@ -0,0 +1,9 @@
services:
anthracite-web:
build: .
ports:
- "8080:80"
volumes:
- type: bind
source: ./default_www/docker_compose/
target: /www

View file

@ -11,6 +11,8 @@
namespace anthracite::socket {
const struct timeval anthracite_socket::timeout_tv = { .tv_sec = 5, .tv_usec = 0};
anthracite_socket::anthracite_socket(int port, int max_queue)
: server_socket(::socket(AF_INET, SOCK_STREAM, 0))
, client_ip("")