move everything into public instead of src/public

makefile
Stein Ivar Berghei 2022-11-21 12:26:33 +01:00
parent da00ab1b66
commit 8727594413
4 changed files with 16 additions and 9 deletions

View File

@ -2,8 +2,8 @@
# docker run -it -v $(pwd)/public:/app/public dndmusicbot-js-build # docker run -it -v $(pwd)/public:/app/public dndmusicbot-js-build
FROM node:19-alpine3.16 FROM node:19-alpine3.16
RUN mkdir /public && chmod 777 /public
WORKDIR /app WORKDIR /app
RUN yarn
ENTRYPOINT ["yarn"] ENTRYPOINT ["yarn"]

View File

@ -2,10 +2,11 @@
APPLICATION_NAME ?= dndmusicbot APPLICATION_NAME ?= dndmusicbot
CURRENT_UID := $(shell id -u) CURRENT_UID := $(shell id -u)
BIN := src/node_modules/.bin BIN := src/node_modules/.bin
YARN = docker run --rm --user $(CURRENT_UID) -v $(CURDIR)/src:/app -v $(CURDIR)/public:/public dndmusicbot-js-build
PHONY: js image build PHONY: js image build clean
js: src/public/script.js js: image public/script.js
image: .jsimage image: .jsimage
@ -13,14 +14,20 @@ image: .jsimage
@docker build -t dndmusicbot-js-build . @docker build -t dndmusicbot-js-build .
@touch .jsimage @touch .jsimage
src/node_modules:
mkdir -p $@
src/yarn.lock: src/node_modules src/package.json src/yarn.lock: src/node_modules src/package.json
@docker run --rm --user $(CURRENT_UID) -v $(CURDIR)/src:/app dndmusicbot-js-build install --production=false --check-files $(YARN)
@touch -mr $(shell ls -Atd $? | head -1) $@ @touch -mr $(shell ls -Atd $? | head -1) $@
src/public/script.js: src/script.js src/yarn.lock public/script.js: src/script.js src/yarn.lock
@docker run --user $(CURRENT_UID) -v $(CURDIR)/src:/app dndmusicbot-js-build build $(YARN) build
$(APPLICATION_NAME): *.go ffmpeg/*.go speaker/*.go $(APPLICATION_NAME): *.go ffmpeg/*.go speaker/*.go
@go build @go build
build: image js $(APPLICATION_NAME) build: image js $(APPLICATION_NAME)
clean:
rm -r public/* src/node_modules .jsimage $(APPLICATION_NAME)

View File

@ -22,7 +22,7 @@ func init() {
app.router.GET("/play/:playlist", app.Play) app.router.GET("/play/:playlist", app.Play)
app.router.GET("/reset", app.Reset) app.router.GET("/reset", app.Reset)
app.router.ServeFiles("/js/*filepath", http.Dir("src/public")) app.router.ServeFiles("/js/*filepath", http.Dir("public"))
app.router.ServeFiles("/css/*filepath", http.Dir("css")) app.router.ServeFiles("/css/*filepath", http.Dir("css"))
app.router.HandlerFunc("GET", "/ws", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { app.router.HandlerFunc("GET", "/ws", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

View File

@ -1,6 +1,6 @@
{ {
"scripts": { "scripts": {
"build": "esbuild script.js --bundle --outdir=public/" "build": "esbuild script.js --bundle --outdir=/public/"
}, },
"dependencies": { "dependencies": {
"esbuild": "^0.15.14", "esbuild": "^0.15.14",