-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmx-base-gitea-build-split-docker04
63 lines (63 loc) · 2.67 KB
/
mx-base-gitea-build-split-docker04
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM base-img:latest AS base-gitea-img
ARG USER_UID
ARG USER_GID
ARG MX_APP_STEP_VERSION
ARG MX_APP_GITEA_VERSION
ARG MX_APP_GITEA_PORT
#
ARG MX_BASE_DIR
ARG MX_BASE_APP_DIR
ARG MX_CONTAINER_NAME
ARG MX_STEP_HOST
ARG MX_STEPPATH
ARG MX_DB_HOST
ARG MX_DB_PORT
ARG MX_DB_SHARED_LOCATION
ARG MX_POSTGRES_USER
ARG MX_POSTGRES_DB
ARG MX_SHARED_GROUP_NAME
#gitea cert 8h for 8 hours
ARG MX_GITEA_CERT_DUR
#a certificate "needs renewal" when it has passed 2% of its allotted lifetime.
ARG MX_GITEA_EXP_CHECK
ARG MX_GIT_DOMAIN
ARG MX_GIT_PORT
ENV MX_BASE_DIR=${MX_BASE_DIR} \
MX_BASE_APP_DIR=${MX_BASE_APP_DIR} \
MX_CONTAINER_NAME=${MX_CONTAINER_NAME} \
MX_STEP_HOST=${MX_STEP_HOST} \
MX_STEPPATH=${MX_STEPPATH} \
STEPPATH=${MX_STEPPATH} \
MX_DB_HOST=${MX_DB_HOST} \
MX_DB_PORT=${MX_DB_PORT} \
MX_DB_SHARED_LOCATION=${MX_DB_SHARED_LOCATION} \
MX_POSTGRES_USER=${MX_POSTGRES_USER} \
MX_POSTGRES_DB=${MX_POSTGRES_DB} \
MX_SHARED_GROUP_NAME=${MX_SHARED_GROUP_NAME} \
MX_GITEA_CERT_DUR=${MX_GITEA_CERT_DUR} \
MX_GITEA_EXP_CHECK=${MX_GITEA_EXP_CHECK} \
MX_GIT_DOMAIN=${MX_GIT_DOMAIN} \
MX_GIT_PORT=${MX_APP_GITEA_PORT}
RUN wget https://dl.smallstep.com/gh-release/cli/gh-release-header/v${MX_APP_STEP_VERSION}/step-cli_${MX_APP_STEP_VERSION}_amd64.rpm \
&& rpm -i step-cli_${MX_APP_STEP_VERSION}_amd64.rpm \
&& rm -rf step-cli_${MX_APP_STEP_VERSION}_amd64.rpm
RUN groupadd -g ${USER_GID} -r gitea1 \
&& useradd -r gitea1 -g gitea1 -u ${USER_UID} -d /home/gitea1
RUN usermod -aG $MX_SHARED_GROUP_NAME gitea1
RUN mkdir -p /home/gitea1/cert /home/gitea1/.ssh /home/gitea1/.tok /home/gitea1/.postgresql /home/gitea1/startup ${MX_BASE_APP_DIR}/data ${MX_BASE_APP_DIR}/custom ${MX_BASE_APP_DIR}/log ${MX_DB_SHARED_LOCATION}
ADD mx-base-gitea/config/start-gitea.sh /home/gitea1/startup/start-gitea.sh
ADD mx-base-gitea/config/renew-certs.sh /home/gitea1/startup/renew-certs.sh
ADD mx-base-gitea/config/app.ini ${MX_BASE_APP_DIR}/custom/app.ini
WORKDIR ${MX_BASE_APP_DIR}
RUN wget https://github.com/go-gitea/gitea/releases/download/v${MX_APP_GITEA_VERSION}/gitea-${MX_APP_GITEA_VERSION}-linux-amd64
RUN chmod 700 /home/gitea1/.ssh && touch /home/gitea1/.ssh/authorized_keys && chmod 600 /home/gitea1/.ssh/authorized_keys
RUN mv gitea-${MX_APP_GITEA_VERSION}-linux-amd64 gitea
RUN chown -R gitea1:gitea1 /home/gitea1 \
&& chown -R gitea1:gitea1 ${MX_DB_SHARED_LOCATION} \
&& chown -R gitea1:gitea1 ${MX_BASE_DIR} \
&& chmod 744 ${MX_BASE_APP_DIR}/gitea \
&& chmod 750 /home/gitea1/startup/*.sh
ENV PATH="${PATH}:${MX_BASE_APP_DIR}"
USER gitea1
WORKDIR /home/gitea1
CMD [ "/usr/bin/bash", "-c", "/home/gitea1/startup/start-gitea.sh"]