image update

This commit is contained in:
2026-11-02 23:17:09 +00:00
parent 1e6d321654
commit 722939a90f
12 changed files with 52 additions and 24 deletions
+2 -1
View File
@@ -1 +1,2 @@
export PROJ=/home/esilva/Desktop/projetos/fax
registry=git.esilva.org
repo=esilva
+1 -1
View File
@@ -11,7 +11,7 @@ RUN apk --no-cache add bash zsh go make sqlite \
# Copy the source files
COPY ./src /frontend-src
COPY ./src/build /frontend
# Add the entrypoint
+15 -5
View File
@@ -1,17 +1,27 @@
include vars.mk
build = ./build/expensesweb
image = $(registry)/$(repo)/fax-frontend:$(tag)
build:
docker buildx build -t esilva-fax .
make -C src build_release_alpine
build_image: build
podman buildx build -t $(image) .
push_image:
podman push $(image)
clean:
docker container rm esilva-fax-container-test --force
podman container rm esilva-fax-container-test --force
attach:
docker exec -u root -it esilva-fax-container zsh
podman exec -u root -it esilva-fax-container zsh
attach-test:
docker exec -u root -it esilva-fax-container-test zsh
podman exec -u root -it esilva-fax-container-test zsh
test: clean
docker run \
podman run \
--name esilva-fax-container-test \
-v ./data.db:/data.db \
-v ./src/config.yml:/etc/fax/config.yml \
+1 -1
View File
@@ -4,4 +4,4 @@ These faxes will be printed on a thermal printer. Pretty neat.
# Docker
You need to mount the `data.db` sqlit3 DB on `/data.db` in the container.
We should change this to a more appropriate location tho.
We should change this to a more appropriate location.
-11
View File
@@ -1,16 +1,5 @@
#!/bin/sh
set -e
if [ ! -d /frontend ]; then
export GOPROXY="https://goproxy.io"
cd /frontend-src
make clean
make build
mv build /frontend
cd ..
rm -r /frontend-src
ln -s /data.db /frontend/data.db
fi
cd /frontend
exec ./frontend --config "/etc/fax/config.yml"
+5
View File
@@ -3,6 +3,11 @@ build: clean
go build -o build/frontend
cp -r ./assets build
build_release_alpine: clean
mkdir build
CGO_ENABLED=1 GOOS=linux CC=musl-gcc go build -o build/frontend
cp -r ./assets build
clean:
rm -rf ./build
+1 -2
View File
@@ -4,6 +4,5 @@ network:
port: "9099"
usb:
path: "/dev/usb/lp0"
fake:
dbpath: "./data.db"
dbpath: "/data.db"
+8
View File
@@ -0,0 +1,8 @@
use: "network"
network:
host: "127.0.0.1"
port: "9099"
usb:
path: "/dev/usb/lp0"
dbpath: "./data.db"
+6
View File
@@ -98,12 +98,18 @@ func (c *Configuration) loadConfiguration(data []byte) error {
errStr := fmt.Sprintf("failed to read file: %s", err)
return errors.New(errStr)
}
log.Println("Loaded configuration from: ", c.Path)
}
log.Println("Config RAW: ", contents)
err := cparser.parseConfigFile(contents)
if err != nil {
return err
}
log.Println("Parsed Config: ", c)
return nil
}
+2 -3
View File
@@ -86,9 +86,6 @@ func SendFax(w http.ResponseWriter, r *http.Request) {
return
}
// REMOVE THIS YO
// time.Sleep(3 * time.Second)
// Create the model access
var dacc models.DB
m, err := models.NewModel(&dacc)
@@ -122,11 +119,13 @@ func SendFax(w http.ResponseWriter, r *http.Request) {
msg := signMessage(message.Text, user.Name, mDate.Format("2006-01-02 15:04:05"))
_, err = sendRequestToPrinter(msg)
if err != nil {
log.Fatalf("Failed to send message: %v\n", err)
// When we have our history table working we can set the state of it here
// log.Println("printer failed to process fax:", err)
// w.Write([]byte("{\"state\":\"failed\"}"))
// return
}
log.Printf("Message sent: %v\n", msg)
/*
Another workflow to add here is to send the message into the DB right away
+3
View File
@@ -4,6 +4,7 @@ import (
"database/sql"
"errors"
"log"
"thermalFax/config"
_ "github.com/mattn/go-sqlite3"
@@ -43,5 +44,7 @@ func (d *DB) openDB() (*sql.DB, error) {
return nil, err
}
log.Println("opened DB on: ", cfg.DBPath)
return db, nil
}
+8
View File
@@ -0,0 +1,8 @@
include $(dir $(lastword $(MAKEFILE_LIST))).env
REQUIRED_VARS := registry repo
$(foreach v,$(REQUIRED_VARS),\
$(if $(value $(v)),,$(error Variable '$(v)' is required but empty)))
tag = v0.1.0