Commit Graph

8 Commits

Author SHA1 Message Date
Gunwant Jain
edc247b558 Templates: fix the content type of templates
Templating is weird af in Rocket. Look into 3a541ae for more.
The content-type of the rendering is determined by the extension of the
template name.

But renaming these templates would break building the project for
development because it finds a phony template there. So the trick is to
default the `template_dir` to `args.upload` because it should never
interfere and will be always present.
This also fixes the hax in Dockerfile by making it the default.

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
2022-01-19 16:33:57 +05:30
Gunwant Jain
3a541aed23 Templates: embed the templates in-binary
Rocket's templating is not exactly friendly when it comes to embedding
in-binary. Rocket's template fairing requires a `template_dir` directory
pointing to the directory containing templates.
A quick workaround to this would be to have custom fairings with
`template_dir` merged with the value `.`
But in bare-metal scenarios like what docker's scratch image mimics, we
don't exactly have a '.' file, so instead for this very project, I have
to point the `template_dir` to the `upload` folder, which is created by
`bin` on execution. Checkout the Dockerfile for more info

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
2022-01-19 01:58:11 +05:30
Gunwant Jain
e91393f63c cli client: update and move to contrib
Signed-off-by: Gunwant Jain <mail@wantguns.dev>
2022-01-18 10:21:32 +05:30
Gunwant Jain
e17a5f7cdb Docker, Cargo: Add multi-arch builds for arm64, x86_64
Builds static binaries instead to be runnable from scratch. This eases
the build process, as we don't have to depend on docker's buildx.
Now images for both arm64 and x86_64 can be built on x86_64 platform
alone.

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
2022-01-18 10:07:26 +05:30
Gunwant Jain
0359a8ef52 docker: Use multi-stage docker builds
Signed-off-by: Gunwant Jain <mail@wantguns.dev>
2022-01-16 22:04:05 +05:30
Gunwant Jain
04c992e8b3 client: write a simple client for the pastebin
Signed-off-by: Gunwant Jain <mail@wantguns.dev>
2021-07-13 21:23:34 +05:30
Gunwant Jain
cb8e210acb dockerfile: shaving off old bits; use rust stable now
Building multi-layered containers gave weird 500 errors. I think they
were permission based but don't have the time to look into it.

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
2021-07-13 04:28:48 +05:30
Gunwant Jain
ea790a066a Dockerised the app
Good use of env vars now

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
2020-12-30 04:20:39 +05:30