don't even know, I will organize later

This commit is contained in:
2026-11-02 23:34:16 +00:00
parent f7e2746c24
commit 4e654abed6
6 changed files with 33 additions and 26 deletions
-6
View File
@@ -4,17 +4,11 @@ FROM alpine:20231219
ENV TZ="Europe/Lisbon" ENV TZ="Europe/Lisbon"
# Install the required packages
RUN apk --no-cache add bash zsh go make \
&& rm -rf /tmp/*
# Copy the source files # Copy the source files
COPY ../src /printer-src COPY ../src /printer-src
# Add the entrypoint # Add the entrypoint
USER $UNAME
COPY ./start.sh /start.sh COPY ./start.sh /start.sh
STOPSIGNAL SIGTERM STOPSIGNAL SIGTERM
ENTRYPOINT [ "/start.sh" ] ENTRYPOINT [ "/start.sh" ]
+14 -6
View File
@@ -1,17 +1,25 @@
build: include vars.mk
docker buildx build -t thprinter .
image = $(registry)/$(repo)/$(name):$(tag)
build_image:
make -B -C src build
podman buildx build -t $(image) .
push_image:
podman push $(image)
clean: clean:
docker container rm thprinter-container-test --force podman container rm thprinter-container-test --force
attach: attach:
docker exec -u root -it thprinter-container zsh podman exec -u root -it thprinter-container zsh
attach-test: attach-test:
docker exec -u root -it thprinter-container-test zsh podman exec -u root -it thprinter-container-test zsh
test: clean test: clean
docker run \ podman run \
--name thprinter-container-test \ --name thprinter-container-test \
-p 9099:9099 \ -p 9099:9099 \
-it thprinter zsh -it thprinter zsh
+10
View File
@@ -40,6 +40,16 @@ Copy the `capabilities.json` file you generated into the `src` directory of this
project. project.
## How to find the printer
On my specific printer:
- turn off
- hold the feed button
- turn it on
- hold the feed button until the lights blink red
- release button
- test page will print with network settings
## Running it ## Running it
Go to the `src` directory and try it with: Go to the `src` directory and try it with:
`$ echo "Something, something" | go run .` `$ echo "Something, something" | go run .`
+3 -2
View File
@@ -1,6 +1,7 @@
build: build: clean
mkdir build mkdir build
go build -o build/printer CGO_ENABLED=1 GOOS=linux CC=musl-gcc \
go build -o build/printer
cp ./capabilities.json ./build/ cp ./capabilities.json ./build/
cp ./config.yaml ./build/ cp ./config.yaml ./build/
-12
View File
@@ -1,17 +1,5 @@
#!/bin/sh #!/bin/sh
set -e set -e
# echo "nameserver 8.8.8.8" >> /etc/resolv.conf
if [ ! -d /printer ]; then
export GOPROXY="https://goproxy.io"
cd /printer-src
make clean
make build
mv build /printer
cd ..
rm -r /printer-src
fi
cd /printer cd /printer
exec ./printer server exec ./printer server
+6
View File
@@ -0,0 +1,6 @@
include $(dir $(lastword $(MAKEFILE_LIST))).env
REQUIRED_VARS := registry repo name tag
$(foreach v,$(REQUIRED_VARS),\
$(if $(value $(v)),,$(error Variable '$(v)' is required but empty)))