mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
feat: add Dockerfile and docker-compose for backend and frontend services
This commit is contained in:
@@ -324,3 +324,5 @@ FodyWeavers.xsd
|
|||||||
**/*.db-wal
|
**/*.db-wal
|
||||||
**/*.db-shm
|
**/*.db-shm
|
||||||
**/*.sqlite
|
**/*.sqlite
|
||||||
|
|
||||||
|
Data
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM node:20-alpine as build
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM node:20-alpine as runner
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build /app .
|
||||||
|
EXPOSE 5173
|
||||||
|
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "5173"]
|
||||||
@@ -2,11 +2,13 @@ import tailwindcss from '@tailwindcss/vite';
|
|||||||
import { sveltekit } from '@sveltejs/kit/vite';
|
import { sveltekit } from '@sveltejs/kit/vite';
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
|
|
||||||
|
const apiUrl = process.env.VITE_API_URL || 'http://localhost:5050';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [tailwindcss(), sveltekit()],
|
plugins: [tailwindcss(), sveltekit()],
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': 'http://localhost:5050'
|
'/api': apiUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
version: '3.8'
|
||||||
|
services:
|
||||||
|
backend:
|
||||||
|
build:
|
||||||
|
context: ./SharpbinV3
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: sharpbin-backend
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Development
|
||||||
|
volumes:
|
||||||
|
- ./SharpbinV3/appsettings.json:/app/appsettings.json
|
||||||
|
- ./SharpbinV3/appsettings.Development.json:/app/appsettings.Development.json
|
||||||
|
- ./Data/sharpbin.db:/app/sharpbin.db
|
||||||
|
networks:
|
||||||
|
- sharpbin-net
|
||||||
|
frontend:
|
||||||
|
build:
|
||||||
|
context: ./SharpbinV3.Client
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: sharpbin-frontend
|
||||||
|
environment:
|
||||||
|
- VITE_API_URL=http://backend:8080
|
||||||
|
volumes:
|
||||||
|
- ./SharpbinV3.Client/src:/app/src
|
||||||
|
- ./SharpbinV3.Client/static:/app/static
|
||||||
|
ports:
|
||||||
|
- "5173:5173"
|
||||||
|
networks:
|
||||||
|
- sharpbin-net
|
||||||
|
networks:
|
||||||
|
sharpbin-net:
|
||||||
|
driver: bridge
|
||||||
Reference in New Issue
Block a user