Skip to content

Commit

Permalink
docker: Make it easier to run on-off commands
Browse files Browse the repository at this point in the history
Set ENTRYPOINT to the Pat executable, and use CMD to provide default
arguments. By doing this, users can run on-off commands with docker as
if the app was running natively on the host.

E.g. `docker compose run pat interactive`.
  • Loading branch information
martinhpedersen committed Nov 5, 2023
1 parent 77cc83b commit 66cd955
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ ENV XDG_CONFIG_HOME=/app
ENV XDG_DATA_HOME=/app
ENV XDG_STATE_HOME=/app
EXPOSE 8080
ENTRYPOINT ["/bin/pat", "http", "--addr", ":8080"]
ENTRYPOINT ["/bin/pat"]
CMD ["http", "--addr", ":8080"]

3 comments on commit 66cd955

@martinhpedersen
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @xylo04 - I wasn't aware of this Docker feature. Very useful 🀩

https://spacelift.io/blog/docker-entrypoint-vs-cmd

@martinhpedersen
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

➜  pat-docker git:(develop) βœ— alias pat="docker compose run pat"
➜  pat-docker git:(develop) βœ— pat connect telnet
[+] Building 0.0s (0/0)                                                               docker-container:multi-arch
2023/11/05 07:00:05 Connecting to WL2K (telnet)...
2023/11/05 07:00:06 Connected to 54.159.175.186:8772 (tcp)
[WL2K-5.0-B2FWIHJM$]
;PQ: 63677644
CMS>
>FF
FQ
2023/11/05 07:00:07 Disconnected.

@martinhpedersen
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on-off == one-off πŸ˜†

Please sign in to comment.