From 78a26e2c832812f67189d40b6abc5002cb3ba12b Mon Sep 17 00:00:00 2001 From: Glenn Marcy Date: Thu, 22 Feb 2024 11:01:51 -0500 Subject: [PATCH] feat: enable github actions for main branch Signed-off-by: Glenn Marcy --- .github/workflows/build-and-push.yml | 40 ++++++++++++++++++++++++++++ Dockerfile | 2 +- nginx.conf | 2 ++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-and-push.yml diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml new file mode 100644 index 0000000..f190b76 --- /dev/null +++ b/.github/workflows/build-and-push.yml @@ -0,0 +1,40 @@ +name: Create and publish a Docker image + +on: + push: + branches: ['main'] + +env: + GHCR_IO_USER: ${{ github.actor }} + GHCR_IO_TOKEN: ${{ github.token }} + DOCKER_IO_USER: ${{ secrets.DOCKER_IO_USER }} + DOCKER_IO_TOKEN: ${{ secrets.DOCKER_IO_TOKEN }} + REPO_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Docker logins + run: | + docker login -u="$GHCR_IO_USER" -p="$GHCR_IO_TOKEN" ghcr.io + docker login -u="$DOCKER_IO_USER" -p="$DOCKER_IO_TOKEN" docker.io + - name: Get current date + id: date + run: echo "date=$(date +'%Y-%m-%d-%H-%M-%S')" >> $GITHUB_OUTPUT + - name: Build the Docker image + run: | + docker build ./ --tag ghcr.io/$REPO_NAME:${{ steps.date.outputs.date }} + - name: Docker Push + run: | + docker push ghcr.io/$REPO_NAME:${{ steps.date.outputs.date }} + docker tag ghcr.io/$REPO_NAME:${{ steps.date.outputs.date }} ghcr.io/$REPO_NAME:latest + docker push ghcr.io/$REPO_NAME:latest diff --git a/Dockerfile b/Dockerfile index 871c08e..a6aa9b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # We start from my nginx fork which includes the proxy-connect module from tEngine # Source is available at https://github.com/rpardini/nginx-proxy-connect-stable-alpine # This is already multi-arch! -ARG BASE_IMAGE="registry.gitlab.com/coreweave/nginx-proxy-connect-stable-alpine:v1.0.1" +ARG BASE_IMAGE="ghcr.io/gmarcy/nginx-proxy-connect-stable-alpine:latest" ARG DEBUG_IMAGE # Could be "-debug" diff --git a/nginx.conf b/nginx.conf index bf05886..4ddfe56 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,3 +1,5 @@ +load_module /etc/nginx/modules/ngx_http_proxy_connect_module.so; + user nginx; worker_processes auto;