From 21965b339d4081724e5da83204e822b96c3f42d7 Mon Sep 17 00:00:00 2001 From: Vyacheslav Scherbinin Date: Sat, 1 Feb 2025 12:42:07 +0700 Subject: [PATCH 1/2] Feature Docker image --- .github/workflows/feature_docker_image.yml | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/feature_docker_image.yml diff --git a/.github/workflows/feature_docker_image.yml b/.github/workflows/feature_docker_image.yml new file mode 100644 index 0000000..544dce1 --- /dev/null +++ b/.github/workflows/feature_docker_image.yml @@ -0,0 +1,61 @@ +name: MultiArchDockerFeature + +on: + push: + branches: + - feature/* + +jobs: + docker: + name: Build multi-arch Docker image. + runs-on: ubuntu-latest + steps: + - name: tag number + run : echo ${{ github.event.release.tag_name }} + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + with: + install: true + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set lower case owner name + run: | + echo "REG_REPO=${REPO,,}" >> ${GITHUB_ENV} + env: + REPO: '${{ github.repository }}' + + - name: Check env + run: | + echo ${{ env.REG_REPO }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/jacred:feature + ghcr.io/${{ env.REG_REPO }}:feature + cache-from: type=gha,scope=${{ github.workflow }} + cache-to: type=gha,mode=max,scope=${{ github.workflow }} From 45e7ea6f44f46ad0d5e828b7e5d75d4010390bf7 Mon Sep 17 00:00:00 2001 From: Vyacheslav Scherbinin Date: Sat, 1 Feb 2025 15:11:59 +0700 Subject: [PATCH 2/2] Alpine --- Dockerfile | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1ea6d5e..62e7008 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,30 @@ -# ### BUILD MAIN IMAGE START ### -FROM ubuntu +### BUILD JACRED MULTIARCH START ### +FROM --platform=$BUILDPLATFORM alpine AS builder + +WORKDIR /app -RUN apt update && apt -y install curl systemd tor tor-geoipdb privoxy -COPY ./privoxy.config /etc/privoxy/config +# Get and unpack JacRed +RUN apk --no-cache --update add bash wget unzip +RUN wget https://github.com/immisterio/jacred-fdb/releases/latest/download/publish.zip +RUN unzip -o publish.zip +RUN rm -f publish.zip +### BUILD JACRED MULTIARCH END ### + +# ### BUILD MAIN IMAGE START ### +FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine -COPY ./install.sh / -COPY ./update.sh / +ENV JACRED_HOME=/home/jacred +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false -RUN sh /install.sh +COPY --from=builder /app $JACRED_HOME/ -WORKDIR /home/jacred +RUN apk --no-cache --update add icu-libs -RUN crontab Data/crontab +WORKDIR $JACRED_HOME EXPOSE 9117 -VOLUME [ "/home/jacred/init.conf", "/home/jacred/Data" ] +VOLUME [ "$JACRED_HOME/init.conf", "$JACRED_HOME/Data" ] -ENTRYPOINT ["/lib/systemd/systemd"] +ENTRYPOINT ["dotnet", "JacRed.dll"] ### BUILD MAIN IMAGE end ### \ No newline at end of file