Skip to content

Commit

Permalink
Merge pull request #11 from realgaurav/update-dockerfile
Browse files Browse the repository at this point in the history
Update Dockerfile and add sample manifest.
  • Loading branch information
gianlucam76 authored Jun 21, 2024
2 parents e6ddd21 + e87799f commit 49ba8c0
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 10 deletions.
28 changes: 18 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
FROM node:14
### staged builds

# Set the working directory in the container
# 1: get the dependencies to copy in the shipping layer.
FROM node:14-alpine as builder
WORKDIR /build
COPY package*.json ./
RUN npm install --only=dev
RUN npm install -D typescript
RUN npm prune

# 2: final layer to ship.
FROM alpine as runner
WORKDIR /app
# copy dependencies from ealier stage.
# TODO: check if the following copy can be further specialized.
COPY . .
COPY --from=builder /build/node_modules/typescript/bin/tsc /usr/bin/tsc
COPY --from=builder /build/node_modules /app/node_modules
RUN apk add --update nodejs npm
# VITE arguments
ARG VITE_BACKEND_PORT
ARG VITE_BACKEND_NAME
COPY package*.json ./
ENV VITE_BACKEND_PORT=${VITE_BACKEND_PORT}
ENV VITE_BACKEND_NAME=${VITE_BACKEND_PORT}
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .

EXPOSE 5173
# Command to run the application in development mode
CMD ["npm", "run", "dev"]

34 changes: 34 additions & 0 deletions manifests/dashboard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: dashboard
namespace: projectsveltos
spec:
replicas: 1
selector:
matchLabels:
app: dashboard
template:
metadata:
labels:
app: dashboard
spec:
containers:
- name: dashboard
image: projectsveltos/dashboard:dev
ports:
- containerPort: 5173
---
apiVersion: v1
kind: Service
metadata:
name: dashboard
namespace: projectsveltos
spec:
selector:
app: dashboard
ports:
- protocol: TCP
port: 80
targetPort: 5173
type: ClusterIP

0 comments on commit 49ba8c0

Please sign in to comment.