alaskartv-api/Dockerfile

43 lines
1.7 KiB
Text
Raw Normal View History

2024-12-19 19:42:51 +00:00
FROM golang:1.23-alpine AS builder
RUN apk --no-cache add git ca-certificates
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o api-server .
FROM alpine:latest
2025-01-06 14:01:45 +00:00
RUN apk --no-cache add git ca-certificates jq curl openssh
2024-12-19 19:42:51 +00:00
WORKDIR /app
2025-01-06 14:01:45 +00:00
COPY --from=builder --chown=1000:1000 /app/api-server .
RUN addgroup -g 1000 appuser && \
adduser -D -u 1000 -G appuser appuser
2024-12-19 19:42:51 +00:00
RUN printf '#!/bin/sh\n\n' > /entrypoint.sh && \
2025-01-06 14:01:45 +00:00
# printf 'if [ -n "$GIT_USERNAME" ] && [ -n "$FORGEJO_TOKEN" ]; then\n' >> /entrypoint.sh && \
printf ' git config --global user.name "AlaskarTV-Bot"\n' >> /entrypoint.sh && \
printf ' git config --global user.email "no-reply@askar.tv}"\n' >> /entrypoint.sh && \
2024-12-19 19:42:51 +00:00
printf ' git config --global credential.helper store\n' >> /entrypoint.sh && \
2025-01-06 14:01:45 +00:00
# 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 'fi\n\n' >> /entrypoint.sh && \
# # Add safe directories
printf 'git config --global --add safe.directory /data/alaskartv-forge/alaskartv-docker\n' >> /entrypoint.sh && \
printf 'git config --global --add safe.directory /data/alaskartv-forge/alaskartv-app\n\n' >> /entrypoint.sh && \
2024-12-19 19:42:51 +00:00
# Finally, run the main app
2024-12-30 00:28:36 +00:00
printf 'crond -b\n' >> /entrypoint.sh && \
2024-12-19 19:42:51 +00:00
printf 'exec /app/api-server\n' >> /entrypoint.sh && \
chmod +x /entrypoint.sh
COPY watchTV.sh /app/watchTV.sh
2024-12-31 04:33:24 +00:00
COPY frontend.html /app/index.html
COPY .botenv /app/.botenv
RUN chmod +x /app/watchTV.sh && \
echo "0 0 * * * /app/watchTV.sh" > /etc/crontabs/root
2025-01-06 14:01:45 +00:00
USER appuser
2024-12-19 19:42:51 +00:00
ENTRYPOINT ["/entrypoint.sh"]