mirror of
https://github.com/siderolabs/image-factory.git
synced 2025-10-26 22:11:37 +01:00
chore: run tailwindcss before creating image
Run tailwindcss as part of build process. Signed-off-by: Noel Georgi <git@frezbo.dev>
This commit is contained in:
parent
81f2cb437f
commit
c7dba02d17
@ -1,6 +1,6 @@
|
|||||||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
|
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
|
||||||
#
|
#
|
||||||
# Generated on 2023-11-02T09:56:23Z by kres latest.
|
# Generated on 2024-03-12T11:43:50Z by kres latest.
|
||||||
|
|
||||||
*
|
*
|
||||||
!cmd
|
!cmd
|
||||||
@ -12,3 +12,6 @@
|
|||||||
!CHANGELOG.md
|
!CHANGELOG.md
|
||||||
!README.md
|
!README.md
|
||||||
!.markdownlint.json
|
!.markdownlint.json
|
||||||
|
!tailwind.config.js
|
||||||
|
!package.json
|
||||||
|
!package-lock.json
|
||||||
|
|||||||
4
.github/workflows/ci.yaml
vendored
4
.github/workflows/ci.yaml
vendored
@ -1,6 +1,6 @@
|
|||||||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
|
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
|
||||||
#
|
#
|
||||||
# Generated on 2024-02-27T07:52:48Z by kres latest.
|
# Generated on 2024-03-12T11:43:50Z by kres latest.
|
||||||
|
|
||||||
name: default
|
name: default
|
||||||
concurrency:
|
concurrency:
|
||||||
@ -48,7 +48,7 @@ jobs:
|
|||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
driver: remote
|
driver: remote
|
||||||
endpoint: tcp://localhost:1234
|
endpoint: tcp://127.0.0.1:1234
|
||||||
timeout-minutes: 1
|
timeout-minutes: 1
|
||||||
- name: base
|
- name: base
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
56
.kres.yaml
56
.kres.yaml
@ -17,6 +17,12 @@ name: image-image-factory
|
|||||||
spec:
|
spec:
|
||||||
baseImage: alpine:3.18
|
baseImage: alpine:3.18
|
||||||
additionalImages: []
|
additionalImages: []
|
||||||
|
allowedLocalPaths:
|
||||||
|
- tailwind.config.js
|
||||||
|
- package.json
|
||||||
|
- package-lock.json
|
||||||
|
dependsOn:
|
||||||
|
- tailwind
|
||||||
customCommands:
|
customCommands:
|
||||||
- apk add --no-cache --update
|
- apk add --no-cache --update
|
||||||
bash
|
bash
|
||||||
@ -56,8 +62,8 @@ spec:
|
|||||||
toplevel: true
|
toplevel: true
|
||||||
- name: integration
|
- name: integration
|
||||||
toplevel: true
|
toplevel: true
|
||||||
inputs:
|
- name: tailwind
|
||||||
- base
|
toplevel: true
|
||||||
---
|
---
|
||||||
kind: custom.Step
|
kind: custom.Step
|
||||||
name: integration.test
|
name: integration.test
|
||||||
@ -118,3 +124,49 @@ spec:
|
|||||||
kind: service.CodeCov
|
kind: service.CodeCov
|
||||||
spec:
|
spec:
|
||||||
targetThreshold: 10 # the actual coverage is much higher and reported from the integration test
|
targetThreshold: 10 # the actual coverage is much higher and reported from the integration test
|
||||||
|
---
|
||||||
|
kind: custom.Step
|
||||||
|
name: tailwind
|
||||||
|
spec:
|
||||||
|
makefile:
|
||||||
|
enabled: true
|
||||||
|
phony: true
|
||||||
|
script:
|
||||||
|
- "@$(MAKE) local-tailwind-copy PUSH=false DEST=."
|
||||||
|
docker:
|
||||||
|
description: "Runs tailwind update"
|
||||||
|
enabled: true
|
||||||
|
stages:
|
||||||
|
- name: tailwind-base
|
||||||
|
description: "Installs tailwindcss"
|
||||||
|
from: docker.io/node:21.7.1-alpine3.19
|
||||||
|
workdir: /src
|
||||||
|
steps:
|
||||||
|
- copy:
|
||||||
|
src: package.json package-lock.json
|
||||||
|
dst: .
|
||||||
|
- script:
|
||||||
|
cache:
|
||||||
|
- /src/node_modules
|
||||||
|
command: npm ci
|
||||||
|
- name: tailwind-update
|
||||||
|
description: "tailwind update"
|
||||||
|
from: tailwind-base
|
||||||
|
steps:
|
||||||
|
- copy:
|
||||||
|
src: tailwind.config.js
|
||||||
|
dst: .
|
||||||
|
- copy:
|
||||||
|
src: internal/frontend/http
|
||||||
|
dst: internal/frontend/http
|
||||||
|
- script:
|
||||||
|
cache:
|
||||||
|
- /src/node_modules
|
||||||
|
command: node_modules/.bin/tailwindcss -i internal/frontend/http/css/input.css -o internal/frontend/http/css/output.css --minify
|
||||||
|
- name: tailwind-copy
|
||||||
|
description: "Copies assets"
|
||||||
|
steps:
|
||||||
|
- copy:
|
||||||
|
from: tailwind-update
|
||||||
|
src: /src/internal/frontend/http/css/output.css
|
||||||
|
dst: internal/frontend/http/css/output.css
|
||||||
|
|||||||
22
Dockerfile
22
Dockerfile
@ -1,15 +1,15 @@
|
|||||||
# syntax = docker/dockerfile-upstream:1.6.0-labs
|
# syntax = docker/dockerfile-upstream:1.7.0-labs
|
||||||
|
|
||||||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
|
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
|
||||||
#
|
#
|
||||||
# Generated on 2024-02-27T07:52:48Z by kres latest.
|
# Generated on 2024-03-12T11:43:50Z by kres latest.
|
||||||
|
|
||||||
ARG TOOLCHAIN
|
ARG TOOLCHAIN
|
||||||
|
|
||||||
FROM alpine:3.18 AS base-image-image-factory
|
FROM alpine:3.18 AS base-image-image-factory
|
||||||
|
|
||||||
# runs markdownlint
|
# runs markdownlint
|
||||||
FROM docker.io/node:21.6.2-alpine3.19 AS lint-markdown
|
FROM docker.io/node:21.7.1-alpine3.19 AS lint-markdown
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
RUN npm i -g markdownlint-cli@0.39.0
|
RUN npm i -g markdownlint-cli@0.39.0
|
||||||
RUN npm i sentences-per-line@0.2.1
|
RUN npm i sentences-per-line@0.2.1
|
||||||
@ -18,6 +18,12 @@ COPY ./CHANGELOG.md ./CHANGELOG.md
|
|||||||
COPY ./README.md ./README.md
|
COPY ./README.md ./README.md
|
||||||
RUN markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js .
|
RUN markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js .
|
||||||
|
|
||||||
|
# Installs tailwindcss
|
||||||
|
FROM docker.io/node:21.7.1-alpine3.19 AS tailwind-base
|
||||||
|
WORKDIR /src
|
||||||
|
COPY package.json package-lock.json .
|
||||||
|
RUN --mount=type=cache,target=/src/node_modules npm ci
|
||||||
|
|
||||||
# base toolchain image
|
# base toolchain image
|
||||||
FROM ${TOOLCHAIN} AS toolchain
|
FROM ${TOOLCHAIN} AS toolchain
|
||||||
RUN apk --update --no-cache add bash curl build-base protoc protobuf-dev
|
RUN apk --update --no-cache add bash curl build-base protoc protobuf-dev
|
||||||
@ -47,6 +53,12 @@ ARG GOFUMPT_VERSION
|
|||||||
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \
|
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \
|
||||||
&& mv /go/bin/gofumpt /bin/gofumpt
|
&& mv /go/bin/gofumpt /bin/gofumpt
|
||||||
|
|
||||||
|
# tailwind update
|
||||||
|
FROM tailwind-base AS tailwind-update
|
||||||
|
COPY tailwind.config.js .
|
||||||
|
COPY internal/frontend/http internal/frontend/http
|
||||||
|
RUN --mount=type=cache,target=/src/node_modules node_modules/.bin/tailwindcss -i internal/frontend/http/css/input.css -o internal/frontend/http/css/output.css --minify
|
||||||
|
|
||||||
# tools and sources
|
# tools and sources
|
||||||
FROM tools AS base
|
FROM tools AS base
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
@ -68,6 +80,10 @@ RUN mkdir -p internal/version/data && \
|
|||||||
echo -n ${SHA} > internal/version/data/sha && \
|
echo -n ${SHA} > internal/version/data/sha && \
|
||||||
echo -n ${TAG} > internal/version/data/tag
|
echo -n ${TAG} > internal/version/data/tag
|
||||||
|
|
||||||
|
# Copies assets
|
||||||
|
FROM scratch AS tailwind-copy
|
||||||
|
COPY --from=tailwind-update /src/internal/frontend/http/css/output.css internal/frontend/http/css/output.css
|
||||||
|
|
||||||
# builds the integration test binary
|
# builds the integration test binary
|
||||||
FROM base AS integration-build
|
FROM base AS integration-build
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go test -c -covermode=atomic -coverpkg=./... -tags integration ./internal/integration
|
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go test -c -covermode=atomic -coverpkg=./... -tags integration ./internal/integration
|
||||||
|
|||||||
18
Makefile
18
Makefile
@ -1,11 +1,11 @@
|
|||||||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
|
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
|
||||||
#
|
#
|
||||||
# Generated on 2024-02-27T07:52:48Z by kres latest.
|
# Generated on 2024-03-12T11:43:50Z by kres latest.
|
||||||
|
|
||||||
# common variables
|
# common variables
|
||||||
|
|
||||||
SHA := $(shell git describe --match=none --always --abbrev=8 --dirty)
|
SHA := $(shell git describe --match=none --always --abbrev=8 --dirty)
|
||||||
TAG := $(shell git describe --tag --always --dirty)
|
TAG := $(shell git describe --tag --always --dirty --match v[0-9]\*)
|
||||||
ABBREV_TAG := $(shell git describe --tags >/dev/null 2>/dev/null && git describe --tag --always --match v[0-9]\* --abbrev=0 || echo 'undefined')
|
ABBREV_TAG := $(shell git describe --tags >/dev/null 2>/dev/null && git describe --tag --always --match v[0-9]\* --abbrev=0 || echo 'undefined')
|
||||||
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
||||||
ARTIFACTS := _out
|
ARTIFACTS := _out
|
||||||
@ -14,15 +14,15 @@ WITH_RACE ?= false
|
|||||||
REGISTRY ?= ghcr.io
|
REGISTRY ?= ghcr.io
|
||||||
USERNAME ?= siderolabs
|
USERNAME ?= siderolabs
|
||||||
REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME)
|
REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME)
|
||||||
PROTOBUF_GO_VERSION ?= 1.32.0
|
PROTOBUF_GO_VERSION ?= 1.33.0
|
||||||
GRPC_GO_VERSION ?= 1.3.0
|
GRPC_GO_VERSION ?= 1.3.0
|
||||||
GRPC_GATEWAY_VERSION ?= 2.19.1
|
GRPC_GATEWAY_VERSION ?= 2.19.1
|
||||||
VTPROTOBUF_VERSION ?= 0.6.0
|
VTPROTOBUF_VERSION ?= 0.6.0
|
||||||
DEEPCOPY_VERSION ?= v0.5.6
|
DEEPCOPY_VERSION ?= v0.5.6
|
||||||
GOLANGCILINT_VERSION ?= v1.56.2
|
GOLANGCILINT_VERSION ?= v1.56.2
|
||||||
GOFUMPT_VERSION ?= v0.6.0
|
GOFUMPT_VERSION ?= v0.6.0
|
||||||
GO_VERSION ?= 1.22.0
|
GO_VERSION ?= 1.22.1
|
||||||
GOIMPORTS_VERSION ?= v0.18.0
|
GOIMPORTS_VERSION ?= v0.19.0
|
||||||
GO_BUILDFLAGS ?=
|
GO_BUILDFLAGS ?=
|
||||||
GO_LDFLAGS ?=
|
GO_LDFLAGS ?=
|
||||||
CGO_ENABLED ?= 0
|
CGO_ENABLED ?= 0
|
||||||
@ -133,7 +133,7 @@ else
|
|||||||
GO_LDFLAGS += -s
|
GO_LDFLAGS += -s
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: unit-tests image-factory image-image-factory integration.test integration lint
|
all: unit-tests image-factory image-image-factory integration.test integration tailwind lint
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean: ## Cleans up all artifacts.
|
clean: ## Cleans up all artifacts.
|
||||||
@ -209,7 +209,7 @@ lint-markdown: ## Runs markdownlint.
|
|||||||
lint: lint-golangci-lint lint-gofumpt lint-govulncheck lint-goimports lint-markdown ## Run all linters for the project.
|
lint: lint-golangci-lint lint-gofumpt lint-govulncheck lint-goimports lint-markdown ## Run all linters for the project.
|
||||||
|
|
||||||
.PHONY: image-image-factory
|
.PHONY: image-image-factory
|
||||||
image-image-factory: ## Builds image for image-factory.
|
image-image-factory: tailwind ## Builds image for image-factory.
|
||||||
@$(MAKE) target-$@ TARGET_ARGS="--tag=$(REGISTRY)/$(USERNAME)/image-factory:$(TAG)"
|
@$(MAKE) target-$@ TARGET_ARGS="--tag=$(REGISTRY)/$(USERNAME)/image-factory:$(TAG)"
|
||||||
|
|
||||||
.PHONY: integration.test
|
.PHONY: integration.test
|
||||||
@ -222,6 +222,10 @@ integration: integration.test
|
|||||||
docker pull $(REGISTRY)/$(USERNAME)/image-factory:$(TAG)
|
docker pull $(REGISTRY)/$(USERNAME)/image-factory:$(TAG)
|
||||||
docker run --rm --net=host --privileged -v /dev:/dev -v $(PWD)/$(ARTIFACTS)/integration.test:/bin/integration.test:ro --entrypoint /bin/integration.test $(REGISTRY)/$(USERNAME)/image-factory:$(TAG) -test.v $(TEST_FLAGS) -test.run $(RUN_TESTS)
|
docker run --rm --net=host --privileged -v /dev:/dev -v $(PWD)/$(ARTIFACTS)/integration.test:/bin/integration.test:ro --entrypoint /bin/integration.test $(REGISTRY)/$(USERNAME)/image-factory:$(TAG) -test.v $(TEST_FLAGS) -test.run $(RUN_TESTS)
|
||||||
|
|
||||||
|
.PHONY: tailwind
|
||||||
|
tailwind:
|
||||||
|
@$(MAKE) local-tailwind-copy PUSH=false DEST=.
|
||||||
|
|
||||||
.PHONY: rekres
|
.PHONY: rekres
|
||||||
rekres:
|
rekres:
|
||||||
@docker pull $(KRES_IMAGE)
|
@docker pull $(KRES_IMAGE)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user