Fix Go version compatibility issues and prevent automatic toolchain downloads
This commit is contained in:
22
Dockerfile
22
Dockerfile
@@ -76,20 +76,36 @@ RUN mkdir -p /build/web/photos /build/web/accounts /build/web/auth /build/web/ca
|
||||
|
||||
FROM cloudron/base:5.0.0@sha256:04fd70dbd8ad6149c19de39e35718e024417c3e01dc9c6637eaf4a41ec4e596c
|
||||
|
||||
# Install necessary packages for both Go and Node.js
|
||||
# Install necessary packages (excluding golang as we'll install it manually)
|
||||
RUN apt-get update && \
|
||||
apt-get install -y curl git nodejs npm golang libsodium23 libsodium-dev pkg-config nginx && \
|
||||
apt-get install -y curl git nodejs npm libsodium23 libsodium-dev pkg-config nginx && \
|
||||
npm install -g yarn serve && \
|
||||
apt-get clean && apt-get autoremove && \
|
||||
rm -rf /var/cache/apt /var/lib/apt/lists
|
||||
|
||||
# Install Go 1.22.2
|
||||
RUN curl -L https://go.dev/dl/go1.22.2.linux-amd64.tar.gz -o go.tar.gz && \
|
||||
rm -rf /usr/local/go && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz && \
|
||||
ln -sf /usr/local/go/bin/go /usr/local/bin/go && \
|
||||
ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt
|
||||
|
||||
# Set up directory structure
|
||||
RUN mkdir -p /app/code /app/data/config /app/web
|
||||
|
||||
WORKDIR /app/code
|
||||
|
||||
# Clone the ente repository during build (for the Museum server)
|
||||
RUN git clone --depth=1 https://github.com/ente-io/ente.git .
|
||||
RUN git clone --depth=1 https://github.com/ente-io/ente.git . && \
|
||||
sed -i 's/go 1.23/go 1.22.2/' server/go.mod
|
||||
|
||||
# Set Go environment variables
|
||||
ENV GOTOOLCHAIN=local
|
||||
ENV GO111MODULE=on
|
||||
ENV GOFLAGS="-mod=mod"
|
||||
ENV PATH="/usr/local/go/bin:${PATH}"
|
||||
ENV GOSUMDB=off
|
||||
|
||||
# Copy the web app built files from the first stage
|
||||
COPY --from=web-builder /build/web/photos /app/web/photos
|
||||
|
Reference in New Issue
Block a user