Changes to forgejo
This commit is contained in:
parent
fd41e9a7a8
commit
6ab1fabdd4
5 changed files with 26 additions and 21 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
.env
|
.env
|
||||||
.botenv
|
.botenv
|
||||||
api-server
|
api-server
|
||||||
|
ssh
|
||||||
|
|
27
Dockerfile
27
Dockerfile
|
@ -6,22 +6,26 @@ COPY . .
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o api-server .
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o api-server .
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
RUN apk --no-cache add git ca-certificates jq curl
|
RUN apk --no-cache add git ca-certificates jq curl openssh
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /app/api-server .
|
COPY --from=builder --chown=1000:1000 /app/api-server .
|
||||||
|
|
||||||
|
RUN addgroup -g 1000 appuser && \
|
||||||
|
adduser -D -u 1000 -G appuser appuser
|
||||||
|
|
||||||
|
|
||||||
RUN printf '#!/bin/sh\n\n' > /entrypoint.sh && \
|
RUN printf '#!/bin/sh\n\n' > /entrypoint.sh && \
|
||||||
printf 'if [ -n "$GIT_USERNAME" ] && [ -n "$GITHUB_TOKEN" ]; then\n' >> /entrypoint.sh && \
|
# printf 'if [ -n "$GIT_USERNAME" ] && [ -n "$FORGEJO_TOKEN" ]; then\n' >> /entrypoint.sh && \
|
||||||
printf ' git config --global user.name "$GIT_USERNAME"\n' >> /entrypoint.sh && \
|
printf ' git config --global user.name "AlaskarTV-Bot"\n' >> /entrypoint.sh && \
|
||||||
printf ' git config --global user.email "${GIT_EMAIL:-no-reply@example.com}"\n' >> /entrypoint.sh && \
|
printf ' git config --global user.email "no-reply@askar.tv}"\n' >> /entrypoint.sh && \
|
||||||
printf ' git config --global credential.helper store\n' >> /entrypoint.sh && \
|
printf ' git config --global credential.helper store\n' >> /entrypoint.sh && \
|
||||||
printf ' echo "https://${GIT_USERNAME}:${GITHUB_TOKEN}@github.com" > /root/.git-credentials\n' >> /entrypoint.sh && \
|
# printf ' echo "https://${GIT_USERNAME}:${FORGEJO_TOKEN}@git.askar.tv" > /root/.git-credentials\n' >> /entrypoint.sh && \
|
||||||
printf ' chmod 600 /root/.git-credentials\n' >> /entrypoint.sh && \
|
# printf ' chmod 600 /root/.git-credentials\n' >> /entrypoint.sh && \
|
||||||
printf 'fi\n\n' >> /entrypoint.sh && \
|
# printf 'fi\n\n' >> /entrypoint.sh && \
|
||||||
# Add safe directories
|
# # Add safe directories
|
||||||
printf 'git config --global --add safe.directory /data/alaskartv/docker-ci\n' >> /entrypoint.sh && \
|
printf 'git config --global --add safe.directory /data/alaskartv-forge/alaskartv-docker\n' >> /entrypoint.sh && \
|
||||||
printf 'git config --global --add safe.directory /data/alaskartv/androidtv-ci\n\n' >> /entrypoint.sh && \
|
printf 'git config --global --add safe.directory /data/alaskartv-forge/alaskartv-app\n\n' >> /entrypoint.sh && \
|
||||||
# Finally, run the main app
|
# Finally, run the main app
|
||||||
printf 'crond -b\n' >> /entrypoint.sh && \
|
printf 'crond -b\n' >> /entrypoint.sh && \
|
||||||
printf 'exec /app/api-server\n' >> /entrypoint.sh && \
|
printf 'exec /app/api-server\n' >> /entrypoint.sh && \
|
||||||
|
@ -33,5 +37,6 @@ COPY .botenv /app/.botenv
|
||||||
RUN chmod +x /app/watchTV.sh && \
|
RUN chmod +x /app/watchTV.sh && \
|
||||||
echo "0 0 * * * /app/watchTV.sh" > /etc/crontabs/root
|
echo "0 0 * * * /app/watchTV.sh" > /etc/crontabs/root
|
||||||
|
|
||||||
|
USER appuser
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
||||||
|
|
2
README.md
Normal file
2
README.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Mount repos on /data/alaskartv-??/
|
||||||
|
Mount ssh key on appuser/.ssh
|
|
@ -1,14 +1,11 @@
|
||||||
services:
|
services:
|
||||||
api-server:
|
api-server:
|
||||||
image: nomadics/api-server:latest
|
image: nomadics/api-forge:latest
|
||||||
container_name: api-server
|
container_name: api-server
|
||||||
ports:
|
ports:
|
||||||
- "9090:8080"
|
- "9999:8080"
|
||||||
environment:
|
|
||||||
- GIT_USERNAME=${GIT_USERNAME}
|
|
||||||
- GIT_EMAIL=${GIT_EMAIL}
|
|
||||||
- GITHUB_TOKEN=${GITHUB_TOKEN}
|
|
||||||
volumes:
|
volumes:
|
||||||
- ~/alaskartv:/data/alaskartv
|
- ~/alaskartv-forge:/data/alaskartv-forge
|
||||||
|
- ~/.ssh/:/home/appuser/.ssh
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
hostname: alaskar-api
|
hostname: alaskar-api
|
||||||
|
|
6
main.go
6
main.go
|
@ -197,7 +197,7 @@ func main() {
|
||||||
}))
|
}))
|
||||||
|
|
||||||
router.POST("/api/alaskarfin", func(c *gin.Context) {
|
router.POST("/api/alaskarfin", func(c *gin.Context) {
|
||||||
jsonResponse, err := updateVersion("/data/alaskartv/docker-ci/alaskarfin", "alaskarfin")
|
jsonResponse, err := updateVersion("/data/alaskartv-forge/alaskartv-docker/alaskarfin", "alaskarfin")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{
|
c.JSON(http.StatusInternalServerError, gin.H{
|
||||||
"error": err.Error(),
|
"error": err.Error(),
|
||||||
|
@ -210,7 +210,7 @@ func main() {
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/alaskarseer", func(c *gin.Context) {
|
router.POST("/api/alaskarseer", func(c *gin.Context) {
|
||||||
jsonResponse, err := updateVersion("/data/alaskartv/docker-ci/alaskarseer", "alaskarseer")
|
jsonResponse, err := updateVersion("/data/alaskartv-forge/alaskartv-docker/alaskarseer", "alaskarseer")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{
|
c.JSON(http.StatusInternalServerError, gin.H{
|
||||||
"error": err.Error(),
|
"error": err.Error(),
|
||||||
|
@ -223,7 +223,7 @@ func main() {
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/alaskartv", func(c *gin.Context) {
|
router.POST("/api/alaskartv", func(c *gin.Context) {
|
||||||
jsonResponse, err := updateVersion("/data/alaskartv/androidtv-ci", "alaskartv")
|
jsonResponse, err := updateVersion("/data/alaskartv-forge/alaskartv-app", "alaskartv")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{
|
c.JSON(http.StatusInternalServerError, gin.H{
|
||||||
"error": err.Error(),
|
"error": err.Error(),
|
||||||
|
|
Loading…
Reference in a new issue