Browse Source

Docker multi-arch base (#1985)

* Create docker/manifest/base.yml

serve as base for build docker image for most platform (386,amd64,arm,arm64)

* Add make task docker-multi-arch-push-manifest

To update references of a multi-arch image on docker registry.

* Use SED_INPLACE generic sed command

* Delete Dockerfile.aarch64

Delete Dockerfile.rpi

* Use gitea/gitea-base as base

and replace deprecated MAINTAINER by LABEL (https://docs.docker.com/engine/reference/builder/#maintainer-deprecated)

* Fix rebase

* Use sapk/gitea-base as base

* Split makefile for docker

* Fix version to v3.6

Could use in later version edge of alpine official library that support multi-arch for armhf.

* Remove sapk/gitea-base and use directly new official alpine multi-arch
Antoine GIRARD 1 year ago
parent
commit
dac0f14f34
5 changed files with 13 additions and 91 deletions
  1. 0 1
      Dockerfile
  2. 0 43
      Dockerfile.aarch64
  3. 0 41
      Dockerfile.rpi
  4. 2 6
      Makefile
  5. 11 0
      docker/Makefile

+ 0 - 1
Dockerfile

@@ -1,5 +1,4 @@
1 1
 FROM alpine:3.6
2
-
3 2
 LABEL maintainer="The Gitea Authors"
4 3
 
5 4
 EXPOSE 22 3000

+ 0 - 43
Dockerfile.aarch64

@@ -1,43 +0,0 @@
1
-FROM multiarch/alpine:aarch64-v3.6
2
-
3
-LABEL maintainer="The Gitea Authors"
4
-
5
-EXPOSE 22 3000
6
-
7
-RUN apk --no-cache add \
8
-    su-exec \
9
-    ca-certificates \
10
-    sqlite \
11
-    bash \
12
-    git \
13
-    linux-pam \
14
-    s6 \
15
-    curl \
16
-    openssh \
17
-    gettext \
18
-    tzdata
19
-RUN addgroup \
20
-    -S -g 1000 \
21
-    git && \
22
-  adduser \
23
-    -S -H -D \
24
-    -h /data/git \
25
-    -s /bin/bash \
26
-    -u 1000 \
27
-    -G git \
28
-    git && \
29
-  echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd
30
-
31
-ENV USER git
32
-ENV GITEA_CUSTOM /data/gitea
33
-
34
-COPY docker /
35
-COPY gitea /app/gitea/gitea
36
-
37
-ENV GODEBUG=netdns=go
38
-
39
-VOLUME ["/data"]
40
-
41
-ENTRYPOINT ["/usr/bin/entrypoint"]
42
-CMD ["/bin/s6-svscan", "/etc/s6"]
43
-

+ 0 - 41
Dockerfile.rpi

@@ -1,41 +0,0 @@
1
-FROM multiarch/alpine:armhf-v3.6
2
-
3
-LABEL maintainer="The Gitea Authors"
4
-
5
-EXPOSE 22 3000
6
-
7
-RUN apk --no-cache add \
8
-    su-exec \
9
-    ca-certificates \
10
-    sqlite \
11
-    bash \
12
-    git \
13
-    linux-pam \
14
-    s6 \
15
-    curl \
16
-    openssh \
17
-    gettext \
18
-    tzdata
19
-RUN addgroup \
20
-    -S -g 1000 \
21
-    git && \
22
-  adduser \
23
-    -S -H -D \
24
-    -h /data/git \
25
-    -s /bin/bash \
26
-    -u 1000 \
27
-    -G git \
28
-    git && \
29
-  echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd
30
-
31
-ENV USER git
32
-ENV GITEA_CUSTOM /data/gitea
33
-ENV GODEBUG=netdns=go
34
-
35
-VOLUME ["/data"]
36
-
37
-ENTRYPOINT ["/usr/bin/entrypoint"]
38
-CMD ["/bin/s6-svscan", "/etc/s6"]
39
-
40
-COPY docker /
41
-COPY gitea /app/gitea/gitea

+ 2 - 6
Makefile

@@ -15,7 +15,6 @@ else
15 15
 endif
16 16
 
17 17
 BINDATA := modules/{options,public,templates}/bindata.go
18
-DOCKER_TAG := gitea/gitea:latest
19 18
 GOFILES := $(shell find . -name "*.go" -type f ! -path "./vendor/*" ! -path "*/bindata.go")
20 19
 GOFMT ?= gofmt -s
21 20
 
@@ -56,6 +55,8 @@ else
56 55
 	endif
57 56
 endif
58 57
 
58
+include docker/Makefile
59
+
59 60
 .PHONY: all
60 61
 all: build
61 62
 
@@ -229,11 +230,6 @@ build: $(EXECUTABLE)
229 230
 $(EXECUTABLE): $(SOURCES)
230 231
 	$(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
231 232
 
232
-.PHONY: docker
233
-docker:
234
-	docker run -ti --rm -v $(CURDIR):/srv/app/src/code.gitea.io/gitea -w /srv/app/src/code.gitea.io/gitea -e TAGS="bindata $(TAGS)" webhippie/golang:edge make clean generate build
235
-	docker build -t $(DOCKER_TAG) .
236
-
237 233
 .PHONY: release
238 234
 release: release-dirs release-windows release-linux release-darwin release-copy release-check
239 235
 

+ 11 - 0
docker/Makefile

@@ -0,0 +1,11 @@
1
+#Makefile related to docker
2
+
3
+DOCKER_IMAGE ?= gitea/gitea
4
+DOCKER_TAG ?= latest
5
+DOCKER_REF := $(DOCKER_IMAGE):$(DOCKER_TAG)
6
+
7
+
8
+.PHONY: docker
9
+docker:
10
+	docker run -ti --rm -v $(CURDIR):/srv/app/src/code.gitea.io/gitea -w /srv/app/src/code.gitea.io/gitea -e TAGS="bindata $(TAGS)" webhippie/golang:edge make clean generate build
11
+	docker build -t $(DOCKER_REF) .