Skip to content

Commit 66b8799

Browse files
committedOct 27, 2024
build: add dockerfile for server and dashboard
1 parent df3bfff commit 66b8799

7 files changed

+202
-16
lines changed
 

‎.dockerignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Project
2+
clients
3+
dashboard
4+
target
5+
6+
# Other
7+
.git
8+
.github
9+
.gitignore
10+
.ds_store

‎Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Build the application
2+
FROM rust:bullseye AS builder
3+
RUN apt update && apt upgrade -y
4+
RUN apt install -y protobuf-compiler libprotobuf-dev
5+
WORKDIR /phantasm
6+
COPY . .
7+
RUN cargo build --release
8+
9+
# Build the application image
10+
FROM debian:bullseye-slim
11+
COPY --from=builder /phantasm/target/release/phantasm /usr/local/bin/phantasm
12+
EXPOSE 2505 2510
13+
ENTRYPOINT ["phantasm"]

‎dashboard/.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
build
3+
.svelte-kit
4+
.prettierignore

‎dashboard/Dockerfile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM node:18 AS builder
2+
WORKDIR /dashboard
3+
COPY package*.json .
4+
RUN npm install
5+
COPY . .
6+
RUN npm run build
7+
RUN npm prune --production
8+
9+
FROM node:18 AS production
10+
WORKDIR /dashboard
11+
12+
# Copy only the necessary files from the build stage.
13+
COPY --from=builder /dashboard/build ./build
14+
COPY --from=builder /dashboard/package.json ./package.json
15+
RUN npm install --only=production
16+
17+
EXPOSE 2515
18+
ENV PORT=2515
19+
CMD ["node", "build"]

‎dashboard/package-lock.json

+153-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dashboard/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"carbon-icons-svelte": "^12.12.0"
2121
},
2222
"devDependencies": {
23-
"@sveltejs/adapter-auto": "^3.0.0",
23+
"@sveltejs/adapter-node": "^5.2.9",
2424
"@sveltejs/kit": "^2.0.0",
2525
"@sveltejs/vite-plugin-svelte": "^3.0.0",
2626
"@types/eslint": "^9.6.0",

‎dashboard/svelte.config.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import adapter from "@sveltejs/adapter-auto"
1+
import adapter from "@sveltejs/adapter-node"
22
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"
33

44
const config = {
55
preprocess: vitePreprocess(),
6-
kit: {
7-
adapter: adapter()
8-
}
6+
kit: { adapter: adapter() }
97
}
108

119
export default config

0 commit comments

Comments
 (0)
Please sign in to comment.