-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from realgaurav/update-dockerfile
Update Dockerfile and add sample manifest.
- Loading branch information
Showing
2 changed files
with
52 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |