From b38c073e9200c58a1f2b8f11399ff3affd88c425 Mon Sep 17 00:00:00 2001 From: Saulo Date: Fri, 27 Dec 2024 14:11:36 -0300 Subject: [PATCH] chore: add dockerfile and CI --- .github/workflows/ci.yml | 42 ++++++++++++++++++++++++++++++++++++++++ Dockerfile | 16 +++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 Dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..70ee4a7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: CI Docker build + +on: + push: + branches: ["main"] + release: + types: [created] + +jobs: + build: + name: Cria imagens e faz deploy HML + runs-on: ubuntu-latest + steps: + - name: Checkout do repo git + uses: actions/checkout@v4 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build Staging + uses: docker/build-push-action@v6 + if: github.ref == 'refs/heads/main' + with: + context: . + file: Dockerfile + push: true + tags: madalozzo/icecast2:staging + + - name: Build Release + uses: docker/build-push-action@v6 + if: github.ref == 'refs/heads/main' + with: + context: . + file: Dockerfile + push: true + tags: madalozzo/icecast2:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fe7835b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM ubuntu:24.04 +LABEL name="ubuntu2404-icecast2-nonroot" +LABEL maintener="Saulo Madalozzo " + +# Install icecast2 +RUN apt-get update && apt-get upgrade -y && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + icecast2 &&\ + apt-get clean &&\ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN useradd user --uid 1002 --create-home --shell /bin/bash +RUN usermod -a -G icecast user +USER user + +ENTRYPOINT ["icecast2", "-c", "/etc/icecast2/icecast.xml"] \ No newline at end of file