You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
3.0 KiB
Docker
64 lines
3.0 KiB
Docker
# syntax=docker/dockerfile:1
|
|
ARG NODE_VERSION=20
|
|
ARG GO_VERSION=1.22
|
|
|
|
FROM node:${NODE_VERSION}-bookworm AS web-builder
|
|
WORKDIR /src
|
|
COPY frontend/package*.json ./frontend/
|
|
RUN cd frontend && npm install
|
|
COPY frontend ./frontend
|
|
COPY core ./core
|
|
RUN cd frontend && npm run build:pro
|
|
|
|
FROM golang:${GO_VERSION}-bookworm AS go-builder
|
|
WORKDIR /src
|
|
ARG GOTOOLCHAIN=auto
|
|
ENV GOTOOLCHAIN=${GOTOOLCHAIN}
|
|
ENV CGO_ENABLED=0
|
|
ENV GOPROXY=https://goproxy.cn,https://proxy.golang.com.cn,direct
|
|
ENV GOSUMDB=sum.golang.google.cn
|
|
COPY core/go.mod core/go.sum ./core/
|
|
COPY agent/go.mod agent/go.sum ./agent/
|
|
RUN cd core && go mod download
|
|
RUN cd agent && go mod download
|
|
COPY . .
|
|
COPY --from=web-builder /src/core/cmd/server/web /src/core/cmd/server/web
|
|
RUN cd core && go build -trimpath -ldflags "-s -w" -o /out/1panel-core ./cmd/server/main.go
|
|
RUN cd agent && go build -trimpath -ldflags "-s -w" -o /out/1panel-agent ./cmd/server/main.go
|
|
|
|
FROM debian:bookworm-slim
|
|
RUN if [ -f /etc/apt/sources.list ]; then \
|
|
sed -i 's|http://deb.debian.org/debian|http://mirrors.tuna.tsinghua.edu.cn/debian|g' /etc/apt/sources.list && \
|
|
sed -i 's|https://deb.debian.org/debian|http://mirrors.tuna.tsinghua.edu.cn/debian|g' /etc/apt/sources.list && \
|
|
sed -i 's|http://security.debian.org/debian-security|http://mirrors.tuna.tsinghua.edu.cn/debian-security|g' /etc/apt/sources.list && \
|
|
sed -i 's|https://security.debian.org/debian-security|http://mirrors.tuna.tsinghua.edu.cn/debian-security|g' /etc/apt/sources.list; \
|
|
fi && \
|
|
if [ -f /etc/apt/sources.list.d/debian.sources ]; then \
|
|
sed -i 's|http://deb.debian.org/debian|http://mirrors.tuna.tsinghua.edu.cn/debian|g' /etc/apt/sources.list.d/debian.sources && \
|
|
sed -i 's|https://deb.debian.org/debian|http://mirrors.tuna.tsinghua.edu.cn/debian|g' /etc/apt/sources.list.d/debian.sources && \
|
|
sed -i 's|http://security.debian.org/debian-security|http://mirrors.tuna.tsinghua.edu.cn/debian-security|g' /etc/apt/sources.list.d/debian.sources && \
|
|
sed -i 's|https://security.debian.org/debian-security|http://mirrors.tuna.tsinghua.edu.cn/debian-security|g' /etc/apt/sources.list.d/debian.sources; \
|
|
fi && \
|
|
apt-get update \
|
|
&& apt-get install -y --no-install-recommends bash ca-certificates tzdata tar gzip grep sed \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
COPY --from=go-builder /out/1panel-core /usr/local/bin/1panel-core
|
|
COPY --from=go-builder /out/1panel-agent /usr/local/bin/1panel-agent
|
|
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
RUN printf '%s\n' \
|
|
'#!/usr/bin/env bash' \
|
|
'BASE_DIR=/opt' \
|
|
'ORIGINAL_PORT=9999' \
|
|
'ORIGINAL_VERSION=v2.0.0' \
|
|
'ORIGINAL_USERNAME=admin' \
|
|
'ORIGINAL_PASSWORD=admin123' \
|
|
'ORIGINAL_ENTRANCE=admin' \
|
|
'LANGUAGE=zh' \
|
|
'CHANGE_USER_INFO=' \
|
|
> /usr/local/bin/1pctl
|
|
COPY core/cmd/server/conf/app.yaml /usr/local/share/1panel/app.yaml
|
|
RUN chmod 755 /usr/local/bin/entrypoint.sh /usr/local/bin/1pctl \
|
|
&& mkdir -p /opt/1panel/conf
|
|
EXPOSE 9999
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|