Package Release Number better licence image Shrunk image Fixed size MASCOT UPDATE fixed CSS and Added Mascot to main site allows Enter to Register/Login changed jpeg cover quality from 70 to 85 Wink over form more CSS fixes linked wiki corrected Readme Reviewed-on: #8 Co-authored-by: riomoo <alister@kamikishi.net> Co-committed-by: riomoo <alister@kamikishi.net> removed ico from LFS fixing ico Reviewed-on: #9 Co-authored-by: riomoo <alister@kamikishi.net> Co-committed-by: riomoo <alister@kamikishi.net> fixing lfs Reviewed-on: #10 Co-authored-by: riomoo <alister@kamikishi.net> Co-committed-by: riomoo <alister@kamikishi.net>
55 lines
1.7 KiB
Text
55 lines
1.7 KiB
Text
# Multi-platform build container for Gopherbook
|
|
FROM golang:alpine AS builder
|
|
|
|
RUN apk add --no-cache \
|
|
musl-dev \
|
|
gcc \
|
|
g++ \
|
|
mingw-w64-gcc \
|
|
wget \
|
|
xz \
|
|
git
|
|
|
|
# Install UPX for binary compression
|
|
RUN wget https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-amd64_linux.tar.xz && \
|
|
tar -xf upx-5.0.2-amd64_linux.tar.xz && \
|
|
mv upx-5.0.2-amd64_linux/upx /usr/local/bin/upx && \
|
|
rm -r upx-5.0.2-amd64_linux upx-5.0.2-amd64_linux.tar.xz
|
|
|
|
WORKDIR /app
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
# Build Linux binary
|
|
RUN echo "Building Linux binary..." && \
|
|
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
|
|
-a \
|
|
-ldflags="-s -w -linkmode external -extldflags '-static'" \
|
|
-trimpath \
|
|
-o bin/gopherbook-linux ./app/gopherbook && \
|
|
upx --best --ultra-brute bin/gopherbook-linux && \
|
|
chmod +x bin/gopherbook-linux
|
|
|
|
# Build Windows binary
|
|
RUN echo "Building Windows binary..." && \
|
|
echo 'IDI_ICON1 ICON "./app/gopherbook/static/images/favicon/favicon.ico"' > gopherbook.rc && \
|
|
x86_64-w64-mingw32-windres gopherbook.rc -o ./app/gopherbook/gopherbook.syso && \
|
|
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc go build \
|
|
-a \
|
|
-ldflags="-s -w" \
|
|
-trimpath \
|
|
-o bin/gopherbook-windows.exe ./app/gopherbook && \
|
|
upx --best --ultra-brute bin/gopherbook-windows.exe && \
|
|
rm ./app/gopherbook/gopherbook.syso gopherbook.rc
|
|
|
|
# Verify binaries were created
|
|
RUN ls -lh bin/ && \
|
|
echo "Build complete!" && \
|
|
echo "Linux binary size: $(du -h bin/gopherbook-linux | cut -f1)" && \
|
|
echo "Windows binary size: $(du -h bin/gopherbook-windows.exe | cut -f1)"
|
|
|
|
# Keep the builder stage as the final stage so we can copy files out
|
|
FROM builder
|