Skip to content

Commit

Permalink
Merge pull request #2 from sonroyaalmerol/migrate-docker-hub
Browse files Browse the repository at this point in the history
Migrate to Github and Docker hub
  • Loading branch information
sonroyaalmerol committed Feb 29, 2024
2 parents 8554614 + c0825d8 commit dbccf4f
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 21 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/developer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Developer image
on: # yamllint disable-line rule:truthy
push:
branches: [main]

jobs:
push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Docker - Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker - GHCR Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

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

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

- name: Docker - Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
tags: type=raw,value=dev
flavor: latest=false

- name: Docker - Build / Push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: Release
on: # yamllint disable-line rule:truthy
release:
types: [published]

jobs:
# Builds the Dockerfile and pushes it to dockerhub and GHCR
release:
name: Release - Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Docker - Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker - GHCR Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

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

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

- name: Docker - Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
flavor: latest=true

- name: Docker - Build / Push
id: docker_build
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
11 changes: 0 additions & 11 deletions .gitlab-ci.yml

This file was deleted.

30 changes: 21 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
# Use the official Go image as the base image
FROM golang:1.21.5-alpine
# Start from the official Golang image
FROM golang:alpine AS build

# Set the working directory inside the container
# Set the Current Working Directory inside the container
WORKDIR /app

# Copy the local package files to the container's workspace
COPY . .
# Copy go mod and sum files
COPY go.mod go.sum ./

# Download and install any dependencies
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download

# Build the Go application
# Copy the source code from the current directory to the Working Directory inside the container
COPY . .

# Build the Go app
RUN go build -o main .

####################

FROM scratch

WORKDIR /

COPY --from=build /app/main /gomain

EXPOSE 8080

# Command to run the executable
ENTRYPOINT ["./main"]
ENTRYPOINT ["/gomain"]


2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ version: '3'

services:
m3u-stream-merger-proxy:
image: registry.snry.xyz/sysadmin/m3u-stream-merger:main-latest
image: sonroyaalmerol/m3u-stream-merger:latest
ports:
- "8080:8080"
volumes:
Expand Down

0 comments on commit dbccf4f

Please sign in to comment.