Skip to content

Commit

Permalink
feat: docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTipo01 committed Sep 2, 2023
1 parent 857bcf5 commit 59f88ef
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish Docker image on release

on:
release:
types: [ published ]

jobs:
push_to_registries:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
thetipo01/videodownloader
ghcr.io/${{ github.repository }}
- name: Build and push Docker images
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM --platform=$BUILDPLATFORM golang:alpine AS build

RUN apk add --no-cache git

RUN git clone https://github.com/TheTipo01/videoDownloader /videoDownloader
WORKDIR /videoDownloader
ARG TARGETOS
ARG TARGETARCH
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go mod download
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o videoDownloader

FROM alpine

RUN apk add --no-cache ffmpeg yt-dlp

COPY --from=build /videoDownloader/videoDownloader /usr/bin/

CMD ["videoDownloader"]
9 changes: 9 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3.9'
services:
bot:
image: thetipo01/videodownloader
# Uncomment the following line to build the image locally
# build: .
restart: always
volumes:
- ${PWD}/config.yml:/config.yml

0 comments on commit 59f88ef

Please sign in to comment.