alaskartv-api/Dockerfile

37 lines
1.5 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
2024-12-20 16:34:51 +00:00
RUN apk --no-cache add git ca-certificates jq curl
2024-12-19 19:42:51 +00:00
WORKDIR /app
COPY --from=builder /app/api-server .
RUN printf '#!/bin/sh\n\n' > /entrypoint.sh && \
printf 'if [ -n "$GIT_USERNAME" ] && [ -n "$GITHUB_TOKEN" ]; then\n' >> /entrypoint.sh && \
printf ' git config --global user.name "$GIT_USERNAME"\n' >> /entrypoint.sh && \
printf ' git config --global user.email "${GIT_EMAIL:-no-reply@example.com}"\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 ' 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/docker-ci\n' >> /entrypoint.sh && \
printf 'git config --global --add safe.directory /data/alaskartv/androidtv-ci\n\n' >> /entrypoint.sh && \
# 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
COPY .botenv /app/.botenv
RUN chmod +x /app/watchTV.sh && \
echo "0 0 * * * /app/watchTV.sh" > /etc/crontabs/root
2024-12-19 19:42:51 +00:00
ENTRYPOINT ["/entrypoint.sh"]