WIP: Dodaj wsparcie dla Dockera #128
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
|||||||
node_modules
|
node_modules
|
||||||
sidebar.js
|
sidebar.js
|
||||||
/web-ext-artifacts/
|
/web-ext-artifacts/
|
||||||
|
/artifacts/
|
||||||
lib/*
|
lib/*
|
||||||
/yarn-error.log
|
/yarn-error.log
|
||||||
/rentgen.zip
|
/rentgen.zip
|
||||||
|
|||||||
41
Dockerfile
41
Dockerfile
@ -79,42 +79,9 @@ RUN apt-get update && apt-get install -y \
|
|||||||
# Set display for Xvfb
|
# Set display for Xvfb
|
||||||
ENV DISPLAY=:99
|
ENV DISPLAY=:99
|
||||||
|
|
||||||
# Create startup script with verbose logging and verification
|
# Copy startup script for extension testing
|
||||||
RUN echo '#!/bin/bash\n\
|
COPY scripts/test_start_extension.sh /app/test_start_extension.sh
|
||||||
set -e\n\
|
RUN chmod +x /app/test_start_extension.sh
|
||||||
echo "Starting Xvfb on display :99..."\n\
|
|
||||||
Xvfb :99 -screen 0 1024x768x24 &\n\
|
|
||||||
XVFB_PID=$!\n\
|
|
||||||
sleep 2\n\
|
|
||||||
\n\
|
|
||||||
echo "Xvfb started with PID: $XVFB_PID"\n\
|
|
||||||
echo "Starting web-ext run with verbose logging..."\n\
|
|
||||||
echo "========================================"\n\
|
|
||||||
\n\
|
|
||||||
# Run web-ext with verbose logging and capture output\n\
|
|
||||||
npx web-ext run --verbose 2>&1 | tee /tmp/web-ext.log &\n\
|
|
||||||
WEBEXT_PID=$!\n\
|
|
||||||
\n\
|
|
||||||
# Wait for extension installation confirmation\n\
|
|
||||||
echo "Waiting for extension to install..."\n\
|
|
||||||
for i in {1..30}; do\n\
|
|
||||||
if grep -q "Installed /app as a temporary add-on" /tmp/web-ext.log 2>/dev/null; then\n\
|
|
||||||
echo "========================================"\n\
|
|
||||||
echo "✓ SUCCESS: Extension installed!"\n\
|
|
||||||
echo "✓ Firefox is running in headless mode"\n\
|
|
||||||
echo "✓ Extension: rentgen@internet-czas-dzialac.pl"\n\
|
|
||||||
echo "✓ Process info:"\n\
|
|
||||||
ps aux | grep -E "(firefox|Xvfb)" | grep -v grep | head -3\n\
|
|
||||||
echo "========================================"\n\
|
|
||||||
echo "Extension is ready. Press Ctrl+C to stop."\n\
|
|
||||||
break\n\
|
|
||||||
fi\n\
|
|
||||||
sleep 1\n\
|
|
||||||
done\n\
|
|
||||||
\n\
|
|
||||||
# Keep container running and show logs\n\
|
|
||||||
wait $WEBEXT_PID\n\
|
|
||||||
' > /app/start.sh && chmod +x /app/start.sh
|
|
||||||
|
|
||||||
# Start script
|
# Start script
|
||||||
CMD ["/app/start.sh"]
|
CMD ["/app/test_start_extension.sh"]
|
||||||
|
|||||||
48
scripts/test_start_extension.sh
Normal file
48
scripts/test_start_extension.sh
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# test_start_extension.sh - Uruchamia rozszerzenie Rentgen w headless Firefox z weryfikacją
|
||||||
|
#
|
||||||
|
# Ten skrypt jest używany przez Docker runtime stage do:
|
||||||
|
# 1. Uruchomienia Xvfb (wirtualny X server) na display :99
|
||||||
|
# 2. Uruchomienia web-ext run z verbose loggingiem
|
||||||
|
# 3. Weryfikacji czy extension został poprawnie zainstalowany
|
||||||
|
# 4. Wyświetlenia czytelnego komunikatu o statusie
|
||||||
|
#
|
||||||
|
# Używany w Dockerfile dla łatwego testowania extensiona bez GUI.
|
||||||
|
# Przeniesiony z inline RUN echo do osobnego pliku dla czytelności.
|
||||||
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Starting Xvfb on display :99..."
|
||||||
|
Xvfb :99 -screen 0 1024x768x24 &
|
||||||
|
XVFB_PID=$!
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo "Xvfb started with PID: $XVFB_PID"
|
||||||
|
echo "Starting web-ext run with verbose logging..."
|
||||||
|
echo "========================================"
|
||||||
|
|
||||||
|
# Run web-ext with verbose logging and capture output
|
||||||
|
npx web-ext run --verbose 2>&1 | tee /tmp/web-ext.log &
|
||||||
|
WEBEXT_PID=$!
|
||||||
|
|
||||||
|
# Wait for extension installation confirmation
|
||||||
|
echo "Waiting for extension to install..."
|
||||||
|
for i in {1..30}; do
|
||||||
|
if grep -q "Installed /app as a temporary add-on" /tmp/web-ext.log 2>/dev/null; then
|
||||||
|
echo "========================================"
|
||||||
|
echo "✓ SUCCESS: Extension installed!"
|
||||||
|
echo "✓ Firefox is running in headless mode"
|
||||||
|
echo "✓ Extension: rentgen@internet-czas-dzialac.pl"
|
||||||
|
echo "✓ Process info:"
|
||||||
|
ps aux | grep -E "(firefox|Xvfb)" | grep -v grep | head -3
|
||||||
|
echo "========================================"
|
||||||
|
echo "Extension is ready. Press Ctrl+C to stop."
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
# Keep container running and show logs
|
||||||
|
wait $WEBEXT_PID
|
||||||
Loading…
x
Reference in New Issue
Block a user