Build web via node docker

This commit is contained in:
Guntis Smaukstelis
2023-12-19 16:06:32 +02:00
parent d08422f929
commit ac8c74fda1
4 changed files with 16 additions and 53 deletions
+1 -17
View File
@@ -1,29 +1,13 @@
# Use a base image with Java and Scala, including SBT
FROM hseeberger/scala-sbt:17.0.2_1.6.2_2.13.8 as build FROM hseeberger/scala-sbt:17.0.2_1.6.2_2.13.8 as build
# Set the working directory
WORKDIR /app WORKDIR /app
# Copy project files to the Docker image
COPY . /app COPY . /app
# Compile the application
RUN sbt clean assembly RUN sbt clean assembly
# Use a smaller base image for the final image
FROM amazoncorretto:17-alpine FROM amazoncorretto:17-alpine
# Copy the compiled JAR from the build stage COPY --from=build /app/web/dist/ /web/dist/
COPY --from=build /app/target/scala-2.13/WeatherTool-assembly-0.1.1-SNAPSHOT.jar /app.jar COPY --from=build /app/target/scala-2.13/WeatherTool-assembly-0.1.1-SNAPSHOT.jar /app.jar
# Define the volume to persist data
VOLUME /data
# Command to run the application
CMD ["java", "-jar", "/app.jar"] CMD ["java", "-jar", "/app.jar"]
# docker build -t scala-app .
# docker run -v /local/data/path:/data scala-app
+6
View File
@@ -2,6 +2,12 @@
Tool for downloading historical and real-time data from 33 weather stations in Latvia. It aggregates and displays data for different time periods, cities, and weather parameters. Tool for downloading historical and real-time data from 33 weather stations in Latvia. It aggregates and displays data for different time periods, cities, and weather parameters.
## Run
```
docker-compose up node
docker-compose up scala
```
## Run ## Run
``` ```
// scala // scala
+9 -2
View File
@@ -1,7 +1,14 @@
version: '3' version: '3'
services: services:
node:
image: node:16.13.1
working_dir: /app/web
volumes:
- $PWD/web:/app/web
command: sh -c "npm install && npm run build"
postgres: postgres:
image: postgres:latest image: postgres:16.1
ports: ports:
- "5432:5432" - "5432:5432"
environment: environment:
@@ -11,7 +18,7 @@ services:
volumes: volumes:
- /var/lib/postgresql/data:/var/lib/postgresql/data - /var/lib/postgresql/data:/var/lib/postgresql/data
scala-app: scala:
build: build:
context: . context: .
dockerfile: Dockerfile.local dockerfile: Dockerfile.local
-34
View File
@@ -1,34 +0,0 @@
## Usage
Those templates dependencies are maintained via [pnpm](https://pnpm.io) via `pnpm up -Lri`.
This is the reason you see a `pnpm-lock.yaml`. That being said, any package manager will work. This file can be safely be removed once you clone a template.
```bash
$ npm install # or pnpm install or yarn install
```
### Learn more on the [Solid Website](https://solidjs.com) and come chat with us on our [Discord](https://discord.com/invite/solidjs)
## Available Scripts
In the project directory, you can run:
### `npm dev` or `npm start`
Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br>
### `npm run build`
Builds the app for production to the `dist` folder.<br>
It correctly bundles Solid in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!
## Deployment
You can deploy the `dist` folder to any static host provider (netlify, surge, now, etc.)