Skip to content

Commit

Permalink
Hotfix: ansible path
Browse files Browse the repository at this point in the history
  • Loading branch information
r-dvl committed Jun 1, 2024
1 parent 767ec47 commit 553ebd4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
19 changes: 10 additions & 9 deletions api/dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM python:3.10

LABEL org.opencontainers.image.source = "https://github.com/r-dvl/ansible-manager"
LABEL org.opencontainers.image.description "Ansible Manager API"
LABEL org.opencontainers.image.source="https://github.com/r-dvl/ansible-manager"
LABEL org.opencontainers.image.description="Ansible Manager API"

# Setup
WORKDIR /api
Expand All @@ -26,13 +26,14 @@ RUN apt-get update && apt-get install -y sshpass cron tzdata && \
COPY ./main.py /api
COPY ./v1 /api/v1

# API listener port
EXPOSE 8080

# Start cron service
RUN service cron start

# Copy startup script
COPY ./start.sh /start.sh

CMD ["/bin/bash", "/start.sh"]
# Ensure the start.sh script is executable
RUN chmod +x /start.sh

# API listener port
EXPOSE 8080

# Start the application using the start.sh script
CMD ["/bin/bash", "/start.sh"]
12 changes: 11 additions & 1 deletion api/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@
# Set Time Zone
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Install and start cron service
# Ensure PATH includes the directory for ansible-playbook
export PATH=$PATH:/usr/local/bin

# Set permissions for the cron file (copied from a volume)
chmod 0644 /etc/cron.d/ansible

# Apply the cron job
crontab /etc/cron.d/ansible

# Start the cron service
service cron start

# Create the log file to be able to run tail
touch /var/log/cron.log

# Start application
python3 ./main.py

0 comments on commit 553ebd4

Please sign in to comment.