mirror of
https://github.com/TheRealOwenRees/chess-scribe-api.git
synced 2026-07-23 01:06:56 +00:00
Hotfix/opam install pgn to tex (#2)
* update to latest ocaml/opam release * remove commented out code * update pgn_to_tex version, pinning github tag * update docker container pull from registry script
This commit is contained in:
@@ -21,11 +21,6 @@ jobs:
|
|||||||
- name: Login to Github Container Registry
|
- name: Login to Github Container Registry
|
||||||
run: echo "${{ secrets.GHCR_SECRET }}" | docker login ghcr.io -u ${{ env.GH_USER }} --password-stdin
|
run: echo "${{ secrets.GHCR_SECRET }}" | docker login ghcr.io -u ${{ env.GH_USER }} --password-stdin
|
||||||
|
|
||||||
# - name: Build image and publish
|
|
||||||
# run: |
|
|
||||||
# docker build . -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
# docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
@@ -53,5 +48,6 @@ jobs:
|
|||||||
port: ${{ secrets.PORT }}
|
port: ${{ secrets.PORT }}
|
||||||
script: |
|
script: |
|
||||||
cd /home/${{ secrets.USERNAME }}
|
cd /home/${{ secrets.USERNAME }}
|
||||||
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
echo "${{ secrets.GHCR_SECRET }}" | docker login ghcr.io -u ${{ env.GH_USER }} --password-stdin
|
||||||
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker compose up -d --force-recreate
|
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
docker compose up -d
|
||||||
|
|||||||
+3
-2
@@ -1,3 +1,4 @@
|
|||||||
_build/
|
_build
|
||||||
_opam/
|
_opam
|
||||||
.env
|
.env
|
||||||
|
.idea
|
||||||
+4
-3
@@ -1,11 +1,12 @@
|
|||||||
# --- STAGE 1: Build the native OCaml binary ---
|
# --- STAGE 1: Build the native OCaml binary ---
|
||||||
# ocaml/opam:debian-13-ocaml-5.4
|
# ocaml/opam:debian-13-ocaml-5.4
|
||||||
FROM ocaml/opam@sha256:a43344fd8178438c12ce3c78124f966ac44fb015c7cc4ba685f980f9a0460091 AS builder
|
FROM ocaml/opam@sha256:82a44b5c39729dbea10a5aa394c544e8d2f6cadd2a8d3f7656c2259c72e3e55a AS builder
|
||||||
USER opam
|
USER opam
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --chown=opam:opam dune-project ./
|
COPY --chown=opam:opam dune-project ./
|
||||||
RUN opam update && opam install -y dune dream
|
RUN opam update && \
|
||||||
RUN opam pin add -y pgn_to_tex git+https://github.com/TheRealOwenRees/pgn_to_tex.git#v0.0.1-rc.2
|
opam pin add -y pgn_to_tex https://github.com/TheRealOwenRees/pgn_to_tex.git#v0.0.1 && \
|
||||||
|
opam install -y dune dream pgn_to_tex
|
||||||
COPY --chown=opam:opam . .
|
COPY --chown=opam:opam . .
|
||||||
RUN opam exec -- dune build bin/main.exe
|
RUN opam exec -- dune build bin/main.exe
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -69,7 +69,7 @@ let handle_convert request =
|
|||||||
let pid =
|
let pid =
|
||||||
Unix.create_process "pdflatex" argv Unix.stdin Unix.stdout Unix.stderr
|
Unix.create_process "pdflatex" argv Unix.stdin Unix.stdout Unix.stderr
|
||||||
in
|
in
|
||||||
(* let _, process_status = Unix.waitpid [] pid in *)
|
|
||||||
let _, _ = Unix.waitpid [] pid in
|
let _, _ = Unix.waitpid [] pid in
|
||||||
|
|
||||||
if Sys.file_exists pdf_file_path then (
|
if Sys.file_exists pdf_file_path then (
|
||||||
@@ -79,7 +79,6 @@ let handle_convert request =
|
|||||||
|
|
||||||
cleanup ();
|
cleanup ();
|
||||||
|
|
||||||
(* TODO: record_metrics "SUCCESS" start_time; *)
|
|
||||||
Dream.respond ~status:`Created
|
Dream.respond ~status:`Created
|
||||||
~headers:
|
~headers:
|
||||||
[
|
[
|
||||||
@@ -102,7 +101,6 @@ let handle_convert request =
|
|||||||
| exn ->
|
| exn ->
|
||||||
cleanup ();
|
cleanup ();
|
||||||
let err_msg = Printexc.to_string exn in
|
let err_msg = Printexc.to_string exn in
|
||||||
(* TODO: record_metrics "FAIL" start_time err_msg; *)
|
|
||||||
(* TODO: logger.error err_msg; *)
|
|
||||||
Dream.json ~status:`Internal_Server_Error
|
Dream.json ~status:`Internal_Server_Error
|
||||||
(Printf.sprintf {|{"type": "error", "message": "%s"}|} err_msg)
|
(Printf.sprintf {|{"type": "error", "message": "%s"}|} err_msg)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ authors: ["Owen Rees<owenrees.dev@gmail.com>"]
|
|||||||
license: "AGPL-3.0-or-later"
|
license: "AGPL-3.0-or-later"
|
||||||
tags: ["chess" "pgn" "pdf"]
|
tags: ["chess" "pgn" "pdf"]
|
||||||
homepage: "https://github.com/therealowenrees/chess-scribe-api"
|
homepage: "https://github.com/therealowenrees/chess-scribe-api"
|
||||||
doc: "https://github.com/therealowenrees/chess-scribe-api/README.md"
|
doc: "https://github.com/therealowenrees/chess-scribe-api/blob/main/README.md"
|
||||||
bug-reports: "https://github.com/therealowenrees/chess-scribe-api/issues"
|
bug-reports: "https://github.com/therealowenrees/chess-scribe-api/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"dune" {>= "3.21"}
|
"dune" {>= "3.21"}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
container_name: chess-scribe-api
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
Reference in New Issue
Block a user