-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7c3227
commit 6dd3834
Showing
6 changed files
with
83 additions
and
56 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
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
This file was deleted.
Oops, something went wrong.
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,40 +1,24 @@ | ||
# 使用 Ubuntu 作为基础镜像 | ||
FROM ubuntu:22.04 | ||
|
||
ARG K8S_VERSION | ||
ARG HELM_VERSION | ||
|
||
# 安装vim | ||
RUN apt-get update && apt-get install -y vim | ||
|
||
# 安装必要的软件包 | ||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y curl bash-completion | ||
|
||
# 安装 kubectl | ||
RUN ARCH=$(uname -m|sed 's|x86_64|amd64|'|sed 's|aarch64|arm64|') && \ | ||
curl -LO "https://dl.k8s.io/release/${K8S_VERSION}/bin/linux/${ARCH}/kubectl" && \ | ||
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \ | ||
rm -rf kubectl | ||
|
||
# 安装 helm | ||
RUN ARCH=$(uname -m|sed 's|x86_64|amd64|'|sed 's|aarch64|arm64|') && \ | ||
curl -LO "https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz" && \ | ||
tar -zxvf helm-${HELM_VERSION}-linux-${ARCH}.tar.gz && \ | ||
rm -rf helm-${HELM_VERSION}-linux-${ARCH}.tar.gz && \ | ||
mv linux-${ARCH}/helm /usr/local/bin/helm && \ | ||
rm -rf linux-${ARCH} | ||
|
||
# 配置 bash 补全和自定义的 PS1 提示符 | ||
RUN echo 'source /etc/profile.d/bash_completion.sh' >> /root/.bashrc \ | ||
&& echo 'source <(kubectl completion bash)' >> /root/.bashrc \ | ||
&& echo 'source <(helm completion bash)' >> /root/.bashrc \ | ||
&& echo "PS1='[\[\033[0;34m\]\u\[\033[0;37m\]@\[\033[0;35m\]\h\[\033[0;33m\] \w\[\033[0;37m\]]\[\033[0;31m\]\$\[\033[00m\] '" >> /root/.bashrc | ||
|
||
# 设置工作目录 | ||
WORKDIR /root | ||
|
||
# 设置环境变量等(可选) | ||
ENV PATH="/usr/local/bin:${PATH}" | ||
|
||
# 启动 bash 终端 | ||
CMD ["sleep", "infinity"] | ||
FROM golang:1.17-alpine as builder | ||
WORKDIR /app | ||
ARG VERSION | ||
ENV GOPROXY=https://goproxy.cn | ||
COPY ../go.mod ./ | ||
COPY ../go.sum ./ | ||
#RUN go mod download | ||
COPY .. . | ||
RUN CGO_ENABLED=0 go build -ldflags "-s -w -X 'main.version=${VERSION}'" -o pixiu ./cmd | ||
|
||
FROM node:16.18.0-alpine as dashboard-builder | ||
WORKDIR /build | ||
RUN apk add git | ||
RUN git clone https://github.com/pixiu-io/dashboard.git | ||
RUN cd dashboard && npm install && npm run build | ||
|
||
FROM busybox as runner | ||
LABEL MAINTAINER="PIXIU" | ||
|
||
COPY --from=builder /app/pixiu /app | ||
COPY --from=dashboard-builder /build/dashboard/dist /static | ||
COPY docker/start.sh /usr/local/bin/pixiu_start | ||
|
||
CMD ["pixiu_start"] |
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,40 @@ | ||
# 使用 Ubuntu 作为基础镜像 | ||
FROM ubuntu:22.04 | ||
|
||
ARG K8S_VERSION | ||
ARG HELM_VERSION | ||
|
||
# 安装vim | ||
RUN apt-get update && apt-get install -y vim | ||
|
||
# 安装必要的软件包 | ||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y curl bash-completion | ||
|
||
# 安装 kubectl | ||
RUN ARCH=$(uname -m|sed 's|x86_64|amd64|'|sed 's|aarch64|arm64|') && \ | ||
curl -LO "https://dl.k8s.io/release/${K8S_VERSION}/bin/linux/${ARCH}/kubectl" && \ | ||
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \ | ||
rm -rf kubectl | ||
|
||
# 安装 helm | ||
RUN ARCH=$(uname -m|sed 's|x86_64|amd64|'|sed 's|aarch64|arm64|') && \ | ||
curl -LO "https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz" && \ | ||
tar -zxvf helm-${HELM_VERSION}-linux-${ARCH}.tar.gz && \ | ||
rm -rf helm-${HELM_VERSION}-linux-${ARCH}.tar.gz && \ | ||
mv linux-${ARCH}/helm /usr/local/bin/helm && \ | ||
rm -rf linux-${ARCH} | ||
|
||
# 配置 bash 补全和自定义的 PS1 提示符 | ||
RUN echo 'source /etc/profile.d/bash_completion.sh' >> /root/.bashrc \ | ||
&& echo 'source <(kubectl completion bash)' >> /root/.bashrc \ | ||
&& echo 'source <(helm completion bash)' >> /root/.bashrc \ | ||
&& echo "PS1='[\[\033[0;34m\]\u\[\033[0;37m\]@\[\033[0;35m\]\h\[\033[0;33m\] \w\[\033[0;37m\]]\[\033[0;31m\]\$\[\033[00m\] '" >> /root/.bashrc | ||
|
||
# 设置工作目录 | ||
WORKDIR /root | ||
|
||
# 设置环境变量等(可选) | ||
ENV PATH="/usr/local/bin:${PATH}" | ||
|
||
# 启动 bash 终端 | ||
CMD ["sleep", "infinity"] |
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,16 @@ | ||
#!/bin/sh | ||
set -o errexit | ||
set -o xtrace | ||
|
||
if [[ ! -d "/etc/pixiu" ]]; then | ||
mkdir -p /etc/pixiu | ||
fi | ||
|
||
if [[ -e "/static/config.json" ]]; then | ||
rm -rf /static/config.json | ||
fi | ||
if [[ -e "/etc/pixiu/config.json" ]]; then | ||
cp /etc/pixiu/config.json /static/config.json | ||
fi | ||
|
||
/app |