diff --git a/.github/workflow/build-push.yml b/.github/workflow/build-push.yml new file mode 100644 index 0000000..4d0550c --- /dev/null +++ b/.github/workflow/build-push.yml @@ -0,0 +1,51 @@ +name: Build and Push Custom Flood Image + +# This workflow is manually triggered from the "Actions" tab in GitHub. +# It requires a single input: the version tag of the flood repository to use. +on: + workflow_dispatch: + inputs: + flood_version: + description: 'New release version for jesec/flood (e.g., v4.4.1)' + required: true + type: string + +jobs: + build_and_push_image: + runs-on: ubuntu-latest + steps: + # Step 1: Checkout the current repository (where this workflow and Dockerfile.client live) + - name: Checkout custom Dockerfile repo + uses: actions/checkout@v4 + + # Step 2: Checkout the flood repository to the specified version + # The checkout will be placed in a subdirectory called 'flood-repo' + - name: Checkout jesec/flood release + uses: actions/checkout@v4 + with: + repository: jesec/flood + ref: ${{ github.event.inputs.flood_version }} + path: flood-repo + + # Step 3: Copy the custom Dockerfile into the flood repository's directory + - name: Copy custom Dockerfile + run: cp Dockerfile.client ./flood-repo/Dockerfile.client + + # Step 4: Login to Docker Hub using the secrets + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + # Step 5: Build and push the Docker image + # This assumes a docker-compose.yml exists in flood-repo and uses Dockerfile. + # It will build, tag, and push the image to your Docker Hub account. + - name: Build and push with Docker Compose + working-directory: ./flood-repo + run: | + # Use the 'docker compose' command to build and push the image. + # The image is tagged with the version provided in the workflow input. + # You might need to adjust the service name (e.g., 'flood') to match your docker-compose.yml + docker buildx build -t 'k2patel/floodui' -f ./Dockerfile.client . + docker push 'k2patel/floodui' \ No newline at end of file diff --git a/Dockerfile.client b/Dockerfile.client new file mode 100644 index 0000000..e9a7938 --- /dev/null +++ b/Dockerfile.client @@ -0,0 +1,62 @@ +# WARNING: +# +# For development and debugging only. Use Dockerfile.release for production. +# +# This image bundles rTorrent for easier debugging. It is not started by default. +# Use --rtorrent argument if you wish to start the bundled rTorrent. +# For production, use rtorrent-flood instead. +# +# This Dockerfile uses contents of current folder which might contain +# secrets, uncommitted changes or other sensitive information. DO NOT +# publish the result image unless it was composed in a clean environment. + +ARG BUILDPLATFORM=amd64 +ARG NODE_IMAGE=docker.io/node:alpine + +FROM --platform=$BUILDPLATFORM ${NODE_IMAGE} as nodebuild + +RUN corepack enable && corepack install -g yarn + +WORKDIR /usr/src/app/ + +# Copy project files +COPY . ./ + +# Fetch dependencies from npm +RUN pnpm install --frozen-lockfile + +# Build assets +RUN npm run build + +# Now get the clean Node.js image +FROM ${NODE_IMAGE} as flood + +WORKDIR /usr/src/app/ + +# Copy sources +COPY --from=nodebuild /usr/src/app ./ + +# Install runtime dependencies +RUN apk --no-cache add \ + mediainfo + +# Create "download" user +# RUN adduser -h /home/download -s /sbin/nologin --disabled-password download + +# Run as "download" user +# USER download + +# Expose port 3000 and 4200 +EXPOSE 3000 +EXPOSE 4200 + +# Creating mountpoint for config +RUN mkdir -p /server/db/ +RUN apk update +RUN apk add coreutils + +# System local configuration +VOLUME /server/db/ + +# Flood server in development mode +ENTRYPOINT ["npm", "--prefix=/usr/src/app/", "run", "start:development:server", "--", "--host=0.0.0.0", "--rundir=/server/"] \ No newline at end of file