Skip to content

Commit

Permalink
Simplify the build process a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
The1Penguin committed Oct 24, 2024
1 parent 7141483 commit 61231d9
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 121 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Dockerfile
docker-compose.yml
flake.nix
flake.lock
static/style.css
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cabal.sandbox.config
*.dump-hi
.direnv/
.envrc
static/style.css
dist-newstyle/
result/
logs/
Lunch at Chalmers_files/
35 changes: 21 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
FROM haskell:9.6.6 as BIN
WORKDIR /app/user
COPY *.cabal ./
from haskell:9.6.6 as bin
workdir /app/user
copy *.cabal ./

RUN cabal v2-update && \
run cabal v2-update && \
cabal v2-build --dependencies-only

COPY . .
RUN cabal v2-install --install-method copy --installdir . --overwrite-policy=always
copy . .

FROM debian:12.5-slim
RUN apt-get update && apt-get install --no-install-recommends -y ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=BIN /app/user/mat-chalmers /bin/mat-chalmers
ENV LANG C.UTF-8
CMD /bin/mat-chalmers
EXPOSE 5007
run curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 && \
mv tailwindcss-linux-x64 tailwindcss && \
chmod +x tailwindcss && \
./tailwindcss --content src/View.hs --output static/style.css --minify

run cabal v2-install --install-method copy --installdir . --overwrite-policy=always


from debian:12.5-slim
run apt-get update && apt-get install --no-install-recommends -y ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
copy --from=bin /app/user/mat-chalmers /bin/mat-chalmers
env LANG C.UTF-8
cmd /bin/mat-chalmers
expose 5007
3 changes: 0 additions & 3 deletions Lunch at Chalmers.html

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ cachix use pingu # Probably more up to date as of 5/6-24

### Updating the view?
Currently, the css framework used is [TailwindCSS](https://tailwindcss.com).
To generate the css file, visit the website, wait until menus have loaded, and then save the html to `Lunch at Chalmers.html`.
Then use [Tailwinds cli](https://tailwindcss.com/blog/standalone-cli) program to generate the new css by running `tailwindcss --content Lunch\ at\ Chalmers.html --output static/style.css --minify`.
To generate css, you can use the [Tailwinds cli](https://tailwindcss.com/blog/standalone-cli) program to generate the new css by running `tailwindcss --content src/View.hs --output static/style.css --minify`.

Worth noting is that the css is embedded in the binary, and changes to it aren't well captured by cabal, so `cabal clean && cabal run` or `docker compose up --build` might be needed to see the updated styling.
Worth noting is that the css is embedded in the binary, and changes to it aren't well captured by cabal, so `cabal clean && cabal run`.
When running `docker compose up --build`, the css file will be generated by it self.

## Credits

Expand Down
5 changes: 0 additions & 5 deletions mat-chalmers.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ Tested-With: GHC ==9.6.6
data-files:
static/style.css
static/icon.png
static/fonts/AnonymousPro-Bold.ttf
static/fonts/AnonymousPro-BoldItalic.ttf
static/fonts/AnonymousPro-Italic.ttf
static/fonts/AnonymousPro-Regular.ttf
static/fonts/OFL.txt

library
default-language: GHC2021
Expand Down
Binary file removed static/fonts/AnonymousPro-Bold.ttf
Binary file not shown.
Binary file removed static/fonts/AnonymousPro-BoldItalic.ttf
Binary file not shown.
Binary file removed static/fonts/AnonymousPro-Italic.ttf
Binary file not shown.
Binary file removed static/fonts/AnonymousPro-Regular.ttf
Binary file not shown.
94 changes: 0 additions & 94 deletions static/fonts/OFL.txt

This file was deleted.

1 change: 0 additions & 1 deletion static/style.css

This file was deleted.

0 comments on commit 61231d9

Please sign in to comment.