Browse Source

Use upstream go image

pull/5003/head
J0WI 7 years ago
parent
commit
ec18a9a51e
  1. 5
      Dockerfile
  2. 32
      docker/build-go.sh
  3. 1
      docker/finalize.sh

5
Dockerfile

@ -1,4 +1,4 @@
FROM alpine:3.5 FROM golang:1.8-alpine
# Install system utils & Gogs runtime dependencies # Install system utils & Gogs runtime dependencies
ADD https://github.com/tianon/gosu/releases/download/1.9/gosu-amd64 /usr/sbin/gosu ADD https://github.com/tianon/gosu/releases/download/1.9/gosu-amd64 /usr/sbin/gosu
@ -27,8 +27,7 @@ COPY public /app/gogs/public
WORKDIR /app/gogs/build WORKDIR /app/gogs/build
COPY . . COPY . .
RUN ./docker/build-go.sh \ RUN ./docker/build.sh \
&& ./docker/build.sh \
&& ./docker/finalize.sh && ./docker/finalize.sh
# Configure Docker Container # Configure Docker Container

32
docker/build-go.sh

@ -1,32 +0,0 @@
#!/bin/sh
# Build GO version as specified in Dockerfile
set -x
set -e
# Components versions
export GOLANG_VERSION="1.8"
export GOLANG_SRC_URL="https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"
export GOLANG_SRC_SHA256="406865f587b44be7092f206d73fc1de252600b79b3cacc587b74b5ef5c623596"
# Install build tools
apk add --no-cache --no-progress --virtual build-deps-go gcc musl-dev openssl go
export GOROOT_BOOTSTRAP="$(go env GOROOT)"
# Download Go
wget -q "$GOLANG_SRC_URL" -O golang.tar.gz
echo "$GOLANG_SRC_SHA256 golang.tar.gz" | sha256sum -c -
tar -C /usr/local -xzf golang.tar.gz
rm golang.tar.gz
# Build
cd /usr/local/go/src
# see https://golang.org/issue/14851
patch -p2 -i /app/gogs/build/docker/no-pic.patch
./make.bash
# Clean
rm /app/gogs/build/docker/*.patch
apk del build-deps-go

1
docker/finalize.sh

@ -10,7 +10,6 @@ mv /app/gogs/build/gogs /app/gogs/
# Final cleaning # Final cleaning
rm -rf /app/gogs/build rm -rf /app/gogs/build
rm /app/gogs/docker/build.sh rm /app/gogs/docker/build.sh
rm /app/gogs/docker/build-go.sh
rm /app/gogs/docker/finalize.sh rm /app/gogs/docker/finalize.sh
rm /app/gogs/docker/nsswitch.conf rm /app/gogs/docker/nsswitch.conf
rm /app/gogs/docker/README.md rm /app/gogs/docker/README.md

Loading…
Cancel
Save