mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-04 14:46:57 -05:00
Docker multi-stage (#2927)
* Setup docker multi-stage and little sugar at it * Make codacy happy ? * Revert back to what the official docker documentation suggest Codacy don't seems to follow https://docs.docker.com/engine/reference/builder/#maintainer-deprecated * Update golang version
This commit is contained in:
parent
b333e7129d
commit
0e26db8bcd
@ -1,5 +0,0 @@
|
|||||||
*
|
|
||||||
!gitea
|
|
||||||
!docker
|
|
||||||
!public
|
|
||||||
!templates
|
|
38
Dockerfile
38
Dockerfile
@ -1,20 +1,41 @@
|
|||||||
|
|
||||||
|
###################################
|
||||||
|
#Build stage
|
||||||
|
FROM golang:1.10-alpine3.7 AS build-env
|
||||||
|
|
||||||
|
ARG GITEA_VERSION
|
||||||
|
ARG TAGS="sqlite"
|
||||||
|
ENV TAGS "bindata $TAGS"
|
||||||
|
|
||||||
|
#Build deps
|
||||||
|
RUN apk --no-cache add build-base git
|
||||||
|
|
||||||
|
#Setup repo
|
||||||
|
COPY . ${GOPATH}/src/code.gitea.io/gitea
|
||||||
|
WORKDIR ${GOPATH}/src/code.gitea.io/gitea
|
||||||
|
|
||||||
|
#Checkout version if set
|
||||||
|
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
|
||||||
|
&& make clean generate build
|
||||||
|
|
||||||
FROM alpine:3.7
|
FROM alpine:3.7
|
||||||
LABEL maintainer="The Gitea Authors"
|
LABEL maintainer="maintainers@gitea.io"
|
||||||
|
|
||||||
EXPOSE 22 3000
|
EXPOSE 22 3000
|
||||||
|
|
||||||
RUN apk --no-cache add \
|
RUN apk --no-cache add \
|
||||||
su-exec \
|
|
||||||
ca-certificates \
|
|
||||||
sqlite \
|
|
||||||
bash \
|
bash \
|
||||||
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
gettext \
|
||||||
git \
|
git \
|
||||||
linux-pam \
|
linux-pam \
|
||||||
s6 \
|
|
||||||
curl \
|
|
||||||
openssh \
|
openssh \
|
||||||
gettext \
|
s6 \
|
||||||
|
sqlite \
|
||||||
|
su-exec \
|
||||||
tzdata
|
tzdata
|
||||||
|
|
||||||
RUN addgroup \
|
RUN addgroup \
|
||||||
-S -g 1000 \
|
-S -g 1000 \
|
||||||
git && \
|
git && \
|
||||||
@ -29,7 +50,6 @@ RUN addgroup \
|
|||||||
|
|
||||||
ENV USER git
|
ENV USER git
|
||||||
ENV GITEA_CUSTOM /data/gitea
|
ENV GITEA_CUSTOM /data/gitea
|
||||||
ENV GODEBUG=netdns=go
|
|
||||||
|
|
||||||
VOLUME ["/data"]
|
VOLUME ["/data"]
|
||||||
|
|
||||||
@ -37,4 +57,4 @@ ENTRYPOINT ["/usr/bin/entrypoint"]
|
|||||||
CMD ["/bin/s6-svscan", "/etc/s6"]
|
CMD ["/bin/s6-svscan", "/etc/s6"]
|
||||||
|
|
||||||
COPY docker /
|
COPY docker /
|
||||||
COPY gitea /app/gitea/gitea
|
COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
|
||||||
|
6
docker/Makefile
vendored
6
docker/Makefile
vendored
@ -7,5 +7,9 @@ DOCKER_REF := $(DOCKER_IMAGE):$(DOCKER_TAG)
|
|||||||
|
|
||||||
.PHONY: docker
|
.PHONY: docker
|
||||||
docker:
|
docker:
|
||||||
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
|
|
||||||
docker build --disable-content-trust=false -t $(DOCKER_REF) .
|
docker build --disable-content-trust=false -t $(DOCKER_REF) .
|
||||||
|
# support also build args docker build --build-arg GITEA_VERSION=v1.2.3 --build-arg TAGS="bindata sqlite" .
|
||||||
|
|
||||||
|
.PHONY: docker-build
|
||||||
|
docker-build:
|
||||||
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user