Skip to content

Commit

Permalink
Merge pull request #25 from sameerdhoot/sameerdhoot-patch-1
Browse files Browse the repository at this point in the history
Implement CI
  • Loading branch information
sameerdhoot committed Jul 26, 2023
2 parents ffb81d8 + 71a0dbd commit 9c1c9d9
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 26 deletions.
84 changes: 67 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,78 @@
---
name: Release
name: Build Docker Containers

on:
push:
tags:
- '*'
branches:
- main
paths-ignore:
- "README.md"
- "LICENSE"
- ".gitignore"
workflow_dispatch:

jobs:
release:

build-alpine:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout
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: Login to Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push Alpine Dockerfile
id: docker_build
uses: docker/[email protected]
with:
platforms: linux/arm64,linux/armhf,linux/386,linux/amd64
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:alpine
pull: false
context: .
file: Dockerfile

build-debian:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build and publish the container image for ${{ github.repository }}:${{ github.ref_name }}
uses: macbre/push-to-ghcr@v9

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

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

- name: Login to Container Registry
uses: docker/login-action@v2
with:
image_name: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: Dockerfile
image_tag: ${{ github.ref_name }}
- name: Build and publish the container image for ${{ github.repository }}:latest
uses: macbre/push-to-ghcr@v9
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push Debian Dockerfile
id: docker_build
uses: docker/[email protected]
with:
image_name: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: Dockerfile
image_tag: latest
platforms: linux/arm64,linux/armhf,linux/386,linux/amd64
push: true
tags: |
ghcr.io/${{ github.repository }}:debian
pull: false
context: .
file: Debian_Dockerfile
15 changes: 11 additions & 4 deletions Debian_Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# docker build -t wolweb .
FROM golang:buster AS builder
FROM golang:1.20-buster AS builder

LABEL org.label-schema.vcs-url="https://github.com/sameerdhoot/wolweb" \
org.label-schema.url="https://github.com/sameerdhoot/wolweb/blob/master/README.md"
Expand All @@ -9,9 +9,8 @@ WORKDIR /wolweb

# Install Dependecies
RUN git clone https://github.com/sameerdhoot/wolweb . && \
go get -d github.com/gorilla/handlers && \
go get -d github.com/gorilla/mux && \
go get -d github.com/ilyakaznacheev/cleanenv
go mod tidy && \
go mod download

# Build Source Files
RUN go build -o wolweb .
Expand All @@ -25,8 +24,16 @@ COPY --from=builder /wolweb/devices.json .
COPY --from=builder /wolweb/config.json .
COPY --from=builder /wolweb/static ./static

RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*

ARG WOLWEBPORT=8089
ENV WOLWEBPORT=${WOLWEBPORT}

CMD ["/wolweb/wolweb"]

EXPOSE ${WOLWEBPORT}
HEALTHCHECK --interval=5s --timeout=3s \
CMD curl --silent --show-error --fail http://localhost:${WOLWEBPORT}/wolweb/health || exit 1
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: "3"
services:
wolweb:
build: .
image: wolweb:latest
container_name: wolweb
image: "ghcr.io/sameerdhoot/wolweb"
restart: always

# make sure that the file exists in local directory from where you are running the compose file
# Or, initialize empty json file by running command "echo '{}' > devices.json"
Expand All @@ -17,7 +17,7 @@ services:
network_mode: host

# Use environment variable below to change port or virtual directory.
#environment:
#WOLWEBPORT: "8089"
environment:
WOLWEBPORT: "8089"
#WOLWEBVDIR: "/wolweb"
#WOLWEBBCASTIP: "192.168.1.255:9"
WOLWEBBCASTIP: "192.168.1.255:9"

0 comments on commit 9c1c9d9

Please sign in to comment.