Skip to content

Commit c2cba82

Browse files
committed
Add environment-to-ini & /usr/local/bin/gitea shim
Fixes #2
1 parent 6469f17 commit c2cba82

File tree

3 files changed

+73
-8
lines changed

3 files changed

+73
-8
lines changed

Dockerfile.armv7l

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
#
2+
# Build environment-to-ini
3+
#
4+
FROM golang:1.18-alpine3.15 AS builder
5+
6+
ARG VERSION
7+
ENV TAGS "bindata timetzdata sqlite sqlite_unlock_notify"
8+
ENV GOARCH arm
9+
10+
RUN apk --no-cache add build-base git nodejs npm curl
11+
12+
WORKDIR ${GOPATH}/src/code.gitea.io/gitea
13+
14+
## GET GITEA-DOCKER FILES
15+
RUN curl -fSL https://github.com/go-gitea/gitea/archive/v$VERSION.tar.gz | \
16+
tar xz gitea-$VERSION/ --strip-components=1
17+
18+
# Begin env-to-ini build
19+
RUN go build contrib/environment-to-ini/environment-to-ini.go
20+
21+
#
22+
# Build runtime image
23+
#
124
FROM balenalib/armv7hf-alpine:latest
225

326
EXPOSE 22 3000
@@ -22,7 +45,8 @@ RUN install_packages \
2245
curl \
2346
gettext \
2447
openssh \
25-
tzdata
48+
tzdata \
49+
gnupg
2650

2751
RUN addgroup \
2852
-S -g 1000 \
@@ -39,11 +63,16 @@ RUN addgroup \
3963
## GITEA RELEASE VERSION
4064
ARG VERSION=1.15.2
4165

66+
RUN apk upgrade --no-cache
67+
68+
COPY --from=builder /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
69+
4270
## GET GITEA-DOCKER FILES
4371
RUN curl -fSL https://github.com/go-gitea/gitea/archive/v$VERSION.tar.gz | \
44-
tar xz gitea-$VERSION/docker --exclude=gitea-$VERSION/docker/Makefile --strip-components=3
72+
tar xz gitea-$VERSION/docker/root --strip-components=3
4573

4674
## GET GITEA
4775
RUN mkdir -p /app/gitea && \
4876
curl -fSLo /app/gitea/gitea https://github.com/go-gitea/gitea/releases/download/v$VERSION/gitea-$VERSION-linux-arm-6 && \
49-
chmod 0755 /app/gitea/gitea
77+
chmod 0755 /usr/bin/entrypoint /app/gitea/gitea /usr/local/bin/gitea /usr/local/bin/environment-to-ini && \
78+
chmod 0755 /etc/s6/gitea/* /etc/s6/openssh/* /etc/s6/.s6-svscan/*

Dockerfile.x86

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
#
2+
# Build environment-to-ini
3+
#
4+
FROM balenalib/armv7hf-alpine-golang:latest-build AS builder
5+
6+
ARG VERSION
7+
ENV TAGS "bindata timetzdata sqlite sqlite_unlock_notify"
8+
ENV GOARCH arm
9+
10+
RUN [ "cross-build-start" ]
11+
12+
RUN apk --no-cache add build-base git nodejs npm curl
13+
14+
WORKDIR ${GOPATH}/src/code.gitea.io/gitea
15+
16+
## GET GITEA-DOCKER FILES
17+
RUN curl -fSL https://github.com/go-gitea/gitea/archive/v$VERSION.tar.gz | \
18+
tar xz gitea-$VERSION/ --strip-components=1
19+
20+
# Begin env-to-ini build
21+
RUN go build -ldflags="-extldflags=-static" contrib/environment-to-ini/environment-to-ini.go
22+
23+
RUN [ "cross-build-end" ]
24+
25+
#
26+
# Build runtime image
27+
#
128
FROM balenalib/armv7hf-alpine:latest
229

330
EXPOSE 22 3000
@@ -24,7 +51,8 @@ RUN install_packages \
2451
curl \
2552
gettext \
2653
openssh \
27-
tzdata
54+
tzdata \
55+
gnupg
2856

2957
RUN addgroup \
3058
-S -g 1000 \
@@ -41,13 +69,18 @@ RUN addgroup \
4169
## GITEA RELEASE VERSION
4270
ARG VERSION=1.15.2
4371

72+
RUN apk upgrade --no-cache
73+
74+
COPY --from=builder /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
75+
4476
## GET GITEA-DOCKER FILES
4577
RUN curl -fSL https://github.com/go-gitea/gitea/archive/v$VERSION.tar.gz | \
46-
tar xz gitea-$VERSION/docker --exclude=gitea-$VERSION/docker/Makefile --strip-components=3
78+
tar xz gitea-$VERSION/docker/root --strip-components=3
4779

4880
## GET GITEA
4981
RUN mkdir -p /app/gitea && \
5082
curl -fSLo /app/gitea/gitea https://github.com/go-gitea/gitea/releases/download/v$VERSION/gitea-$VERSION-linux-arm-6 && \
51-
chmod 0755 /app/gitea/gitea
83+
chmod 0755 /usr/bin/entrypoint /app/gitea/gitea /usr/local/bin/gitea /usr/local/bin/environment-to-ini && \
84+
chmod 0755 /etc/s6/gitea/* /etc/s6/openssh/* /etc/s6/.s6-svscan/*
5285

5386
RUN [ "cross-build-end" ]

build.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ if [ "$(docker images -q ${REPO}:${VERSION} 2> /dev/null)" != "" ]; then
1515
exit 2
1616
fi
1717

18-
set -x
1918
docker build --pull --tag "${REPO}:${VERSION}" --build-arg "VERSION=${VERSION}" --file "Dockerfile.$(uname -m)" .
20-
echo "[INFO] Build Complete. Validate version:"
19+
20+
printf "\n[\e[1;34mINFO\e[0m] Build Complete. \e[1;36mValidate version=%s\e[0m:\n" "${VERSION}"
2121
docker run --rm "${REPO}:${VERSION}" /app/gitea/gitea --version
22+
23+
printf "\n[\e[1;34mINFO\e[0m] Build Complete. \e[1;36mValidate startup & HTTP Port 9999\e[0m:\n"
24+
docker run --rm -it -e GITEA__SERVER__HTTP_PORT=9999 "${REPO}:${VERSION}"

0 commit comments

Comments
 (0)