Skip to content

Commit

Permalink
feat: gains development dockerization (#12)
Browse files Browse the repository at this point in the history
* expose host url to dev dockerfile

* add dev Dockerfile and compose

* only COPY necessary files

* remove old comment

* add more useful comments

* remove "as build"

* rename techmix dataset

* volume mount json assets
  • Loading branch information
jdhoffa authored Jul 26, 2024
1 parent 912717c commit 8483ada
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
28 changes: 28 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Build the Svelte application
# Use the official Node.js image as the base image
FROM node:18-alpine

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install the dependencies
RUN npm install

# Copy necessary configurations to the working directory
COPY postcss.config.cjs ./
COPY svelte.config.js ./
COPY tailwind.config.ts ./
COPY tsconfig.json ./
COPY vite.config.ts ./

# Copy the source code to the working directory
COPY src ./src
COPY static ./static
COPY .svelte-kit ./.svelte-kit

EXPOSE 3000

CMD ["npm", "run", "dev"]
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
services:
svelte-app:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- '3000:3000'
volumes:
- type: bind
source: ${JSON_ASSETS_PATH}
target: /app/src/json
read_only: true
File renamed without changes.
2 changes: 1 addition & 1 deletion src/routes/sector_view.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- src/routes/sector_view.svelte -->
<script>
import { onMount } from 'svelte';
import techmix_data from '../json/data_techmix.json';
import techmix_data from '../json/data_techexposure.json';
import traj_data from '../json/data_trajectory_alignment.json';
import emissions_data from '../json/data_emissions.json';
import { techexposure } from '../js/techexposure.js';
Expand Down
8 changes: 6 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [sveltekit(), purgeCss()]
});
plugins: [sveltekit(), purgeCss()],
server: {
host: true,
port: 3000
}
});

0 comments on commit 8483ada

Please sign in to comment.