mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-03 12:18:48 +08:00
- 新增 /etc/profile.d 脚本,在 login shell 重置 PATH 后恢复 Go 工具链路径 - 修正 ENV PATH 中无效的 /root/go/bin 为 GOPATH 实际路径 /go/bin
53 lines
1.6 KiB
Docker
53 lines
1.6 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
ARG GO_IMAGE=golang:1.25-bookworm
|
|
ARG NODE_IMAGE=node:20-bookworm
|
|
|
|
FROM ${NODE_IMAGE} AS node
|
|
|
|
FROM ${GO_IMAGE}
|
|
|
|
ARG WEBKIT_API=4.0
|
|
ARG WAILS_VERSION=v2.11.0
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ENV PATH=/go/bin:/usr/local/go/bin:${PATH}
|
|
|
|
# Debian's /etc/profile resets PATH in login shells (bash -l), dropping the Go
|
|
# toolchain; restore it via profile.d which is sourced after that reset.
|
|
RUN printf 'export PATH=/go/bin:/usr/local/go/bin:$PATH\n' > /etc/profile.d/10-gonavi-build-env.sh
|
|
|
|
# Copy only Node.js runtime assets so the Go toolchain from the base image
|
|
# stays intact for smoke tests and interactive build shells.
|
|
COPY --from=node /usr/local/bin/node /usr/local/bin/node
|
|
COPY --from=node /usr/local/bin/npm /usr/local/bin/npm
|
|
COPY --from=node /usr/local/bin/npx /usr/local/bin/npx
|
|
COPY --from=node /usr/local/bin/corepack /usr/local/bin/corepack
|
|
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
bash \
|
|
build-essential \
|
|
ca-certificates \
|
|
curl \
|
|
file \
|
|
git \
|
|
make \
|
|
pkg-config \
|
|
python3 \
|
|
unzip \
|
|
zip \
|
|
libgtk-3-dev \
|
|
&& if [ "${WEBKIT_API}" = "4.1" ]; then \
|
|
apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev libsoup-3.0-dev; \
|
|
else \
|
|
apt-get install -y --no-install-recommends libwebkit2gtk-4.0-dev; \
|
|
fi \
|
|
&& go install github.com/wailsapp/wails/v2/cmd/wails@${WAILS_VERSION} \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /workspace
|
|
|
|
CMD ["bash"]
|