Dockerfile for CSS

This commit is contained in:
aceberg 2023-01-07 03:38:59 +07:00
parent 4c8a008151
commit 3e85b42449
6 changed files with 86 additions and 30 deletions

58
.github/workflows/css-docker-all.yml vendored Normal file
View file

@ -0,0 +1,58 @@
name: CSS-Docker
on:
workflow_dispatch:
# push:
# branches: [ "main" ]
# paths:
# - 'Dockerfile'
# - 'src/**'
env:
IMAGE_NAME: watchyourlan
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get version tag from env file
uses: c-py/action-dotenv-to-setenv@v2
with:
env-file: .version
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile.css
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:css
${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:css-${{ env.VERSION }}
ghcr.io/${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:css
ghcr.io/${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:css-${{ env.VERSION }}

View file

@ -16,14 +16,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get version tag from env file
uses: c-py/action-dotenv-to-setenv@v2
with:
env-file: .version
- name: Echo version
run: echo ${{ env.VERSION }}
- name: Build and Push Docker Image to docker.io
uses: mr-smithers-excellent/docker-build-push@v5
with:

21
Dockerfile.css Normal file
View file

@ -0,0 +1,21 @@
FROM golang:alpine AS builder
RUN apk add build-base npm
COPY . /src
RUN cd /src/cmd/WatchYourLAN/ && CGO_ENABLED=0 go build -o /WatchYourLAN .
RUN cd / && npm i bootswatch && npm i bootstrap-icons
FROM alpine
WORKDIR /app
RUN apk add --no-cache tzdata arp-scan \
&& mkdir /data
COPY --from=builder /WatchYourLAN /app/
COPY --from=builder /node_modules /app/
ENTRYPOINT ["./WatchYourLAN"]
CMD ["-b", "/app/node_modules"]

View file

@ -9,9 +9,9 @@ import (
const configPath = "/data/config"
// const bootPath = ""
const bootPath = ""
const bootPath = "/data/node_modules/bootswatch/dist/sketchy"
// const bootPath = "/data/node_modules"
func main() {
confPtr := flag.String("c", configPath, "Path to config file")

File diff suppressed because one or more lines are too long

View file

@ -12,7 +12,9 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
{{ else }}
<!-- Bootstrap and theme -->
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/bootswatch/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
<!-- Font for icons -->
<link rel="stylesheet" href="/css/bootstrap-icons/font/bootstrap-icons.css">
{{ end }}
</head>
<body>
@ -38,15 +40,10 @@
<input name="search" type="text" class="form-control text-dark" placeholder="Search">
<button type="submit" class="btn btn-primary">Search</button>
</li>
</form>
<!-- <li class="nav-item"><a class="nav-link active" target="_blank" href="https://github.com/aceberg/WatchYourLAN">
<h3>&nbsp;&nbsp;&nbsp;<i class="bi bi-github"></i></h3>
</a></li> -->
</form>
&nbsp;&nbsp;&nbsp;
<li class="nav-item"><a class="nav-link active" target="_blank" href="https://github.com/aceberg/WatchYourLAN">
<h3><svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" fill="currentColor" class="bi bi-github" viewBox="0 0 16 16">
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"/>
</svg></h3>
<h3><i class="bi bi-github"></i></h3>
</a></li>
</ul>
</div>