Add makefile, clean up some docker stuff
parent
ddf24071b0
commit
27032d75a5
|
@ -10,8 +10,9 @@ js/*.min.js
|
||||||
cache
|
cache
|
||||||
|
|
||||||
bin
|
bin
|
||||||
ambiance/*.mp3
|
ambiance
|
||||||
|
|
||||||
*.yml
|
*.yml
|
||||||
public/
|
public/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
src/node_modules
|
||||||
|
|
|
@ -4,8 +4,6 @@ FROM node:19-alpine3.16
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY . /app
|
|
||||||
|
|
||||||
RUN yarn
|
RUN yarn
|
||||||
|
|
||||||
ENTRYPOINT ["yarn", "build"]
|
ENTRYPOINT ["yarn"]
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
APPLICATION_NAME ?= dndmusicbot
|
||||||
|
CURRENT_UID := $(shell id -u)
|
||||||
|
|
||||||
|
default: build
|
||||||
|
|
||||||
|
image: Dockerfile
|
||||||
|
docker build -t dndmusicbot-js-build .
|
||||||
|
touch .jsimage
|
||||||
|
|
||||||
|
web: src/script.js
|
||||||
|
docker run --user $(CURRENT_UID) -v $(CURDIR)/src:/app dndmusicbot-js-build install
|
||||||
|
docker run --user $(CURRENT_UID) -v $(CURDIR)/src:/app dndmusicbot-js-build build
|
||||||
|
|
||||||
|
build: *.go
|
||||||
|
go build
|
|
@ -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("public"))
|
app.router.ServeFiles("/js/*filepath", http.Dir("src/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) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "esbuild js/script.js --bundle --outdir=public/"
|
"build": "esbuild script.js --bundle --outdir=public/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.15.14",
|
"esbuild": "^0.15.14",
|
|
@ -130,11 +130,11 @@ window.onload = function () {
|
||||||
document.querySelector("#addambiance").addEventListener("click", (e) => {
|
document.querySelector("#addambiance").addEventListener("click", (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
output.innerText = ""
|
//output.innerText = ""
|
||||||
var title = document.querySelector("#inputambiance > input[name='title']")
|
var title = document.querySelector("#inputambiance > input[name='title']")
|
||||||
var url = document.querySelector("#inputambiance > input[name='url']")
|
var url = document.querySelector("#inputambiance > input[name='url']")
|
||||||
if (title.value == "" || url.value == "") {
|
if (title.value == "" || url.value == "") {
|
||||||
output.innerText = "Title or Url is empty!"
|
console.log("Title or Url is empty!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ window.onload = function () {
|
||||||
submit.addEventListener("click", (e) => {
|
submit.addEventListener("click", (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
output.innerText = ""
|
//output.innerText = ""
|
||||||
var title = document.querySelector("#inputplaylist > input[name='title']")
|
var title = document.querySelector("#inputplaylist > input[name='title']")
|
||||||
var url = document.querySelector("#inputplaylist > input[name='url']")
|
var url = document.querySelector("#inputplaylist > input[name='url']")
|
||||||
if (title.value == "" || url.value == "") {
|
if (title.value == "" || url.value == "") {
|
Loading…
Reference in New Issue