From ac8c74fda185a55a52f593b08a154edebf4383ce Mon Sep 17 00:00:00 2001 From: Guntis Smaukstelis Date: Tue, 19 Dec 2023 16:06:32 +0200 Subject: [PATCH] Build web via node docker --- Dockerfile.local | 18 +----------------- README.md | 6 ++++++ docker-compose.yml | 11 +++++++++-- web/README.md | 34 ---------------------------------- 4 files changed, 16 insertions(+), 53 deletions(-) delete mode 100644 web/README.md diff --git a/Dockerfile.local b/Dockerfile.local index cea7166..950515c 100644 --- a/Dockerfile.local +++ b/Dockerfile.local @@ -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 -# Set the working directory WORKDIR /app - -# Copy project files to the Docker image COPY . /app -# Compile the application RUN sbt clean assembly -# Use a smaller base image for the final image 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 -# Define the volume to persist data -VOLUME /data - -# Command to run the application CMD ["java", "-jar", "/app.jar"] - - - - -# docker build -t scala-app . -# docker run -v /local/data/path:/data scala-app \ No newline at end of file diff --git a/README.md b/README.md index 20c5deb..d4f36e6 100644 --- a/README.md +++ b/README.md @@ -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. +## Run +``` +docker-compose up node +docker-compose up scala +``` + ## Run ``` // scala diff --git a/docker-compose.yml b/docker-compose.yml index ed3078a..4bba4d9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,14 @@ version: '3' 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: - image: postgres:latest + image: postgres:16.1 ports: - "5432:5432" environment: @@ -11,7 +18,7 @@ services: volumes: - /var/lib/postgresql/data:/var/lib/postgresql/data - scala-app: + scala: build: context: . dockerfile: Dockerfile.local diff --git a/web/README.md b/web/README.md deleted file mode 100644 index 434f7bb..0000000 --- a/web/README.md +++ /dev/null @@ -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.
-Open [http://localhost:3000](http://localhost:3000) to view it in the browser. - -The page will reload if you make edits.
- -### `npm run build` - -Builds the app for production to the `dist` folder.
-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.
-Your app is ready to be deployed! - -## Deployment - -You can deploy the `dist` folder to any static host provider (netlify, surge, now, etc.)