Dockerfile.css

This commit is contained in:
aceberg 2023-01-07 15:38:45 +07:00
parent c695b86199
commit 272f60ea10
4 changed files with 37 additions and 11 deletions

27
.github/workflows/css-dev-docker.yml vendored Normal file
View file

@ -0,0 +1,27 @@
name: Dev-to-docker
on:
workflow_dispatch:
env:
IMAGE_NAME: watchyourlan
TAGS: dev-css
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build and Push Docker Image to docker.io
uses: mr-smithers-excellent/docker-build-push@v5
with:
image: ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}
tags: ${{ env.TAGS }}
registry: docker.io
dockerfile: Dockerfile.css
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

View file

@ -1,11 +1,9 @@
FROM golang:bullseye AS builder
RUN cd / && git clone https://github.com/twbs/icons.git
RUN cd / && git clone https://github.com/thomaspark/bootswatch.git
COPY . /src
RUN apt update && apt install -y npm
RUN cd / && npm i bootswatch > /dev/null 2>&1 \
&& npm i bootstrap-icons > /dev/null 2>&1
RUN cd /src/cmd/WatchYourLAN/ && CGO_ENABLED=0 go build -o /WatchYourLAN .
@ -14,10 +12,13 @@ FROM alpine
WORKDIR /app
RUN apk add --no-cache tzdata arp-scan \
&& mkdir /data
&& mkdir /data \
&& mkdir -p /app/css/bootswatch/dist \
&& mkdir -p /app/css/bootstrap-icons/font
COPY --from=builder /WatchYourLAN /app/
COPY --from=builder /node_modules /app/
COPY --from=builder /icons/font /app/css/bootstrap-icons/font
COPY --from=builder /bootswatch/dist /app/css/bootswatch/dist
ENTRYPOINT ["./WatchYourLAN"]
CMD ["-b", "/app/node_modules"]
CMD ["-b", "/app/css"]

View file

@ -29,7 +29,7 @@ check: fmt lint
go-build:
cd cmd/WatchYourLAN/ && \
go build .
CGO_ENABLED=0 go build -o ../../tmp/WatchYourLAN .
docker-build:
docker build -t $(DUSER)/$(DNAME) .

View file

@ -11,8 +11,6 @@ const configPath = "/data/config"
const bootPath = ""
// const bootPath = "/data/node_modules"
func main() {
confPtr := flag.String("c", configPath, "Path to config file")
bootPtr := flag.String("b", bootPath, "Path to local Bootswatch")