-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
90 lines (77 loc) · 2.58 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# VpK (Visually presented Kubernetes)
# Docker build file base image
# FROM node:18.17.1
# FROM node:20
FROM node:21.5-slim
LABEL maintainer="k8svisual"
# Create directories
RUN mkdir /vpk
RUN mkdir /vpk/cluster
RUN mkdir /vpk/usage
# Copy files to container image
WORKDIR /vpk
COPY lib/ ./lib
COPY public/ ./public
COPY package.json .
COPY server.js .
COPY vpkconfig.json .
COPY LICENSE .
COPY README.md .
# Install curl and latest version of kubectl inside image
# and ensure kubectl is executable
RUN apt-get update \
&& apt-get install -y curl \
&& apt-get install -y sshpass \
&& npm install \
&& curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl \
&& rm kubectl
# Add command to start VpK with option to indicate running in container '-c yes'
CMD ["sh", "-c", "node server.js -c yes"]
# Expose the default web port so browser can communicate
EXPOSE 4200/tcp
# MacOS how to get host IP address
# ifconfig | grep 'inet ' | grep -v '127.0.0.1' | head -n 1 | awk '{print $2}'
#EXAMPLE docker commands build and tag
#docker build .
#docker build ---- use buildDocker.sh shell ----
#docker tag k8svisual/vpk:latest k8svisual/vpk:6.1.0
#docker push k8svisual/vpk:6.1.0
#EXAMPLE docker command to run VpK and map volume and port
#docker run -v /Users/bob/snaptest/:/vpk/cluster -p 4500:4200 k8svisual/vpk
#EXAMPLE docker command to open shell via exec
# docker ps
# copy k8svisual/vpk CONTAINER ID to clip board
#docker exec -it (paste Containe ID) sh
#EXAMPLE docker command to run command in vpk container
#docker run -it k8svisual/vpk sh
#======================= Multi-platform docker images =========================
#
# List existing builds
#
# docker buildx ls
#
# Create a New Builder Instance:
# Docker buildx operates with the concept of "builders", which are essentially
# environments where the build process runs. Create a new builder instance
# which has support for multi-architecture builds:
#
# docker buildx create --name mybuilder --use
#
# Start up the Builder:
# After creating a builder, you need to start it:
#
# docker buildx inspect --bootstrap
#
# Build the image:
# Now, use the docker buildx build command to build the image for multiple
# architectures. You need to specify each architecture with the --platform
# flag. For example, to build for arm64 and amd64:
#
# docker buildx build --platform linux/amd64,linux/arm64 -t k8svisual/vpk:latest . --push
#
# Verify the Image:
#
# docker manifest inspect k8svisual/vpk:latest
#
#