In the simple case of running Gitea from inside a Docker container, the current Dockerfile assumes you have already compiled Gitea and have it available to create the image.
In my case, I do not have Gitea currently installed on my machine. I am on Mac OSX and my thought was that if I build on this machine, but the Gitea Dockerfile uses Alpine Linux as its base image, there would be some conflict in this case? Can someone clarify if that would be an issue?
The workaround I thought of was to build Gitea directly inside the container with Alpine Linux. The other possibility would be for me to compile on Mac OSX and then change the base image I suppose.
Do these two workarounds make sense and which one would be preferable? Does the binary that we use in the image also have to be compatible with the base image? I think so, but welcome your inputs as well.
Edit: I've tried compiling inside the container, but ran into a problem. From the DockerHub available Dockerfile is below:
FROM alpine:3.7
LABEL maintainer="The Gitea Authors"
EXPOSE 22 3000
RUN apk --no-cache add \
su-exec \
ca-certificates \
sqlite \
bash \
git \
linux-pam \
s6 \
curl \
openssh \
gettext \
tzdata \
make
RUN addgroup \
-S -g 1000 \
git && \
adduser \
-S -H -D \
-h /data/git \
-s /bin/bash \
-u 1000 \
-G git \
git && \
echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" |
chpasswd
# Dockerfile assumes Gitea is already up and running
# In this case, copy the source to container and Compile Gitea in Alpine
Environment
COPY gitea-master.zip /
RUN unzip gitea-master.zip
RUN cd gitea-master
RUN make generate all
You can see I've added instructions to copy gitea into the container, unzip, cd into the directory and the build, but I get the following output:
Step 1/17 : FROM alpine:3.7
---> 3fd9065eaf02
Step 2/17 : LABEL maintainer="The Gitea Authors"
---> Using cache
---> b6bb053b3e89
Step 3/17 : EXPOSE 22 3000
---> Using cache
---> ade88a29df64
Step 4/17 : RUN apk --no-cache add su-exec ca-certificates
sqlite bash git linux-pam s6 curl openssh
gettext tzdata make
---> Using cache
---> 460a5562c60f
Step 5/17 : RUN addgroup -S -g 1000 git && adduser -S -H -D
-h /data/git -s /bin/bash -u 1000 -G git git && echo
"git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd
---> Using cache
---> 07ff1f0b2d3e
Step 6/17 : COPY gitea-master.zip /
---> Using cache
---> 3ad1e3177659
Step 7/17 : RUN unzip gitea-master.zip
---> Using cache
---> 61a2beb19e1e
Step 8/17 : RUN cd gitea-master
---> Using cache
---> 6985914927b9
Step 9/17 : RUN make generate all
---> Running in 3e603f88c302
make: *** No rule to make target 'generate'. Stop.
The command '/bin/sh -c make generate all' returned a non-zero code: 2
The Makefile clearly shows that those targets are available however, but this has got me a bit stumped. Any suggestions ?