From ef7132bf3d3c55108ba954f5326c0ee5b2ce9773 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Tue, 6 Aug 2024 20:45:11 +0100 Subject: [PATCH] build: de-dupe goreleaser I don't really know why I duplicated the build process in .goreleaser.yaml, when I could have just called the Makefile. --- .goreleaser.yml | 42 ++---------------------------------------- Dockerfile | 2 +- 2 files changed, 3 insertions(+), 41 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 972e025..0b5bec8 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -8,46 +8,8 @@ release: name_template: "v{{.Version}}" before: hooks: - - go mod download - - rm -rf data/web - - mkdir -p data/web/css - - cp images/banner.svg static/banner.svg - - bash -c 'cp -r static/* data/web/' - - npm install - - npm install esbuild - - cp node_modules/remixicon/fonts/remixicon.css node_modules/remixicon/fonts/remixicon.woff2 data/web/css/ - - cp -r html data/ - - node scripts/missing-colors.js html data/html - - cp -r lang data/ - - cp LICENSE data/ - - cp jfa-go.service data/ - - python3 scripts/enumerate_config.py -i config/config-base.json -o data/config-base.json - - python3 scripts/generate_ini.py -i config/config-base.json -o data/config-default.ini - - python3 scripts/compile_mjml.py -o data/ - - rm -rf tempts - - cp -r ts tempts - - scripts/dark-variant.sh tempts - - scripts/dark-variant.sh tempts/modules - - mkdir -p data/web/js - - npx esbuild --target=es6 --bundle tempts/admin.ts {{.Env.JFA_GO_SOURCEMAP}} --outfile=./data/web/js/admin.js {{.Env.JFA_GO_MINIFY}} - - npx esbuild --target=es6 --bundle tempts/user.ts {{.Env.JFA_GO_SOURCEMAP}} --outfile=./data/web/js/user.js {{.Env.JFA_GO_MINIFY}} - - npx esbuild --target=es6 --bundle tempts/pwr.ts {{.Env.JFA_GO_SOURCEMAP}} --outfile=./data/web/js/pwr.js {{.Env.JFA_GO_MINIFY}} - - npx esbuild --target=es6 --bundle tempts/pwr-pin.ts {{.Env.JFA_GO_SOURCEMAP}} --outfile=./data/web/js/pwr-pin.js {{.Env.JFA_GO_MINIFY}} - - npx esbuild --target=es6 --bundle tempts/form.ts {{.Env.JFA_GO_SOURCEMAP}} --outfile=./data/web/js/form.js {{.Env.JFA_GO_MINIFY}} - - npx esbuild --target=es6 --bundle tempts/setup.ts {{.Env.JFA_GO_SOURCEMAP}} --outfile=./data/web/js/setup.js {{.Env.JFA_GO_MINIFY}} - - npx esbuild --target=es6 --bundle tempts/crash.ts {{.Env.JFA_GO_SOURCEMAP}} --outfile=./data/crash.js {{.Env.JFA_GO_MINIFY}} - - bash -c "{{.Env.JFA_GO_COPYTS}}" - - rm -r tempts - - npx esbuild --bundle css/base.css --outfile=./data/web/css/bundle.css --external:remixicon.css --external:../fonts/hanken* --minify - - cp html/crash.html data/ - - npx tailwindcss -i data/web/css/bundle.css -o data/bundle.css --content "html/crash.html" - - node scripts/inline.js root data data/crash.html data/crash.html - - rm data/bundle.css - - npx tailwindcss -i data/web/css/bundle.css -o data/web/css/bundle.css - - mv data/crash.html data/html/ - - go install github.com/swaggo/swag/cmd/swag@latest - - swag init -g main.go - - mv data/web/css/bundle.css data/web/css/{{.Env.JFA_GO_CSS_VERSION}}bundle.css + - npm i + - make precompile INTERNAL=on builds: - id: notray dir: ./ diff --git a/Dockerfile b/Dockerfile index 5b44376..ee67fd7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ COPY . /opt/build # && apt-get install build-essential python3-pip -y \ # && (curl -sL https://deb.nodesource.com/setup_current.x | bash -) \ # && apt-get install nodejs -RUN (cd /opt/build; npm i; make precompile INTERNAL=off GOESBUILD=on) \ +RUN (cd /opt/build; npm i; make precompile INTERNAL=off GOESBUILD=off) \ && sed -i 's#id="password_resets-watch_directory" placeholder="/config/jellyfin"#id="password_resets-watch_directory" value="/jf" disabled#g' /opt/build/build/data/html/setup.html FROM --platform=$BUILDPLATFORM docker.io/golang:latest AS build