Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
keynmol committed Sep 23, 2024
1 parent cfe2da5 commit 1b32479
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
23 changes: 13 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ RUN wget https://raw.githubusercontent.com/VirtusLab/scala-cli/main/scala-cli.sh
chmod +x scala-cli && \
scala-cli config power true && \
scala-cli version && \
echo '@main def hello = println(42)' | scala-cli run _ --js -S 3.5.0
echo '@main def hello = println(42)' | scala-cli run _ --js -S 3.5.1

WORKDIR /scratch

COPY backend/project.scala .
COPY shared/ ./shared/

RUN scala-cli compile project.scala
COPY backend/project.scala backend/project.scala

COPY frontend/src/project.scala .
RUN cd backend && scala-cli compile project.scala --server=false

RUN scala-cli compile project.scala
COPY frontend/src/project.scala frontend/src/project.scala

RUN cd frontend/src && scala-cli compile project.scala --server=false

WORKDIR /source/frontend
COPY frontend/package.json .
Expand All @@ -26,14 +28,15 @@ RUN npm install

WORKDIR /source

COPY . .
COPY shared/ ./shared/

COPY frontend/ ./frontend/
WORKDIR /source/frontend
RUN rm -rf frontend/.scala-build frontend/.bsp frontend/.bloop
RUN rm -rf backend/.scala-build backend/.bsp backend/.bloop
RUN npm run buildDocker

WORKDIR /source/frontend
RUN npm install
RUN npm run build
COPY backend/ /source/backend/
RUN rm -rf backend/.scala-build backend/.bsp backend/.bloop

WORKDIR /source/backend
RUN scala-cli package . --assembly -f -o ./optimizer-backend --offline --server=false
Expand Down
4 changes: 3 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"scripts": {
"dev": "concurrently npm:watchScalajs vite",
"build": "npm run buildScalajsRelease && vite build",
"buildDocker": "npm run buildScalajsReleaseDocker && vite build",
"preview": "vite preview",
"watchScalajs": "scala-cli --power package src -w -f -o scalajs-frontend.js --js-module-kind es",
"buildScalajs": "scala-cli --power package src -f -o scalajs-frontend.js --js-module-kind es",
"buildScalajsRelease": "scala-cli --power package . -f -o scalajs-frontend.js --js-mode release --js-module-kind es"
"buildScalajsRelease": "scala-cli --power package . -f -o scalajs-frontend.js --js-mode release --js-module-kind es",
"buildScalajsReleaseDocker": "scala-cli --power package . -f -o scalajs-frontend.js --js-mode release --js-module-kind es --server=false"
},
"devDependencies": {
"concurrently": "^8.2.2",
Expand Down

0 comments on commit 1b32479

Please sign in to comment.