Skip to content

Commit 193e513

Browse files
authored
Merge pull request #24 from JohanDevl/develop
Code Restructuring and Modularization
2 parents 8ee1935 + e257719 commit 193e513

File tree

15 files changed

+1700
-677
lines changed

15 files changed

+1700
-677
lines changed

.github/workflows/docker-test.yml

Lines changed: 4 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ jobs:
4040
# Check if the required scripts exist and are executable
4141
docker run --rm trakt-export:test ls -la /app/Export_Trakt_4_Letterboxd.sh /app/setup_trakt.sh /app/docker-entrypoint.sh
4242
43+
# Check if lib directory exists and scripts are executable
44+
docker run --rm trakt-export:test bash -c "find /app/lib -name '*.sh' -type f -executable || echo 'No executable scripts found in lib directory'"
45+
4346
# Check if the required directories exist
44-
docker run --rm trakt-export:test ls -la /app/config /app/logs /app/copy /app/brain_ops /app/backup /app/TEMP
47+
docker run --rm trakt-export:test ls -la /app/config /app/logs /app/copy /app/backup /app/TEMP
4548
4649
# Check if the entrypoint script works correctly
4750
docker run --rm trakt-export:test bash -c "test -x /app/docker-entrypoint.sh && echo '✅ Entrypoint script is executable'"
@@ -94,66 +97,6 @@ jobs:
9497
9598
echo "✅ Docker Compose test completed successfully"
9699
97-
- name: Test Docker image with mock data
98-
run: |
99-
echo "🔍 Testing Docker image with mock data..."
100-
101-
# Create a test container with mounted volumes
102-
mkdir -p ./test-data/config ./test-data/logs ./test-data/copy ./test-data/brain_ops ./test-data/backup
103-
104-
# Create a mock configuration file
105-
cat > ./test-data/config/.config.cfg << 'EOF'
106-
API_KEY="test_key"
107-
API_SECRET="test_secret"
108-
API_URL="https://api.trakt.tv"
109-
ACCESS_TOKEN="test_token"
110-
REFRESH_TOKEN="test_refresh"
111-
REDIRECT_URI="urn:ietf:wg:oauth:2.0:oob"
112-
USERNAME="test_user"
113-
BACKUP_DIR="./backup/test_backup"
114-
DOSLOG="./logs"
115-
DOSCOPY="./copy"
116-
BRAIN_OPS="./brain_ops"
117-
DATE="20250101_0000"
118-
LOG="${DOSLOG}/test-Export_Trakt.txt"
119-
RED='\033[0;31m'
120-
GREEN='\033[0;32m'
121-
NC='\033[0m'
122-
BOLD='\033[1m'
123-
SAISPAS='\e[1;33;41m'
124-
EOF
125-
126-
# Create example config file in the test directory
127-
cp ./test-data/config/.config.cfg ./test-data/config/.config.cfg.example
128-
129-
# Start the container with the mock data and keep it running with sleep
130-
docker run -d --name test-container-mock \
131-
-v $(pwd)/test-data/config:/app/config \
132-
-v $(pwd)/test-data/logs:/app/logs \
133-
-v $(pwd)/test-data/copy:/app/copy \
134-
-v $(pwd)/test-data/brain_ops:/app/brain_ops \
135-
-v $(pwd)/test-data/backup:/app/backup \
136-
trakt-export:test sleep 60
137-
138-
# Wait a moment to ensure the container is running
139-
sleep 5
140-
141-
# Check if the container is running
142-
docker ps | grep test-container-mock
143-
144-
# Check if the container can access the mounted volumes
145-
docker exec test-container-mock bash -c "ls -la /app/config /app/logs /app/copy /app/brain_ops /app/backup"
146-
147-
# Check if the configuration file is accessible
148-
docker exec test-container-mock bash -c "cat /app/config/.config.cfg | grep API_KEY"
149-
150-
# Clean up
151-
docker stop test-container-mock
152-
docker rm test-container-mock
153-
rm -rf ./test-data
154-
155-
echo "✅ Docker image test with mock data completed successfully"
156-
157100
- name: Summary
158101
run: |
159102
echo "🎉 All Docker image tests passed successfully!"

.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ creds.js
3737
# Cursor
3838
.cursor/
3939

40+
# Temporary directory
41+
/TEMP
42+
/TEMP/
43+
TEMP/
44+
45+
# Backup directory
46+
/backup
47+
/backup/
48+
backup/
49+
4050
# Byte-compiled / optimized / DLL files
4151
__pycache__/
4252
*.py[cod]
@@ -53,7 +63,6 @@ dist/
5363
downloads/
5464
eggs/
5565
.eggs/
56-
lib/
5766
lib64/
5867
parts/
5968
sdist/
@@ -177,3 +186,4 @@ dmypy.json
177186
cython_debug/
178187
*.tar.gz
179188
/logs
189+

Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,27 @@ WORKDIR /app
1515
COPY . /app/
1616

1717
# Create necessary directories
18-
RUN mkdir -p /app/backup /app/logs /app/copy /app/brain_ops /app/TEMP /app/config
18+
RUN mkdir -p /app/backup /app/logs /app/copy /app/TEMP /app/config
1919

2020
# Make scripts executable
2121
RUN chmod +x /app/Export_Trakt_4_Letterboxd.sh /app/setup_trakt.sh /app/docker-entrypoint.sh
22+
RUN find /app/lib -name "*.sh" -exec chmod +x {} \;
23+
RUN [ -f /app/install.sh ] && chmod +x /app/install.sh || echo "install.sh not found"
2224

2325
# Set proper permissions for volume directories
24-
RUN chmod -R 777 /app/backup /app/logs /app/copy /app/brain_ops /app/config
26+
RUN chmod -R 777 /app/backup /app/logs /app/copy /app/config
27+
RUN chmod -R 755 /app/lib
2528

2629
# Set environment variables
2730
ENV DOSLOG=/app/logs \
2831
DOSCOPY=/app/copy \
29-
BRAIN_OPS=/app/brain_ops \
3032
BACKUP_DIR=/app/backup \
33+
CONFIG_DIR=/app/config \
3134
CRON_SCHEDULE="" \
3235
EXPORT_OPTION="normal"
3336

3437
# Set volume for persistent data
35-
VOLUME ["/app/logs", "/app/copy", "/app/brain_ops", "/app/backup", "/app/config"]
38+
VOLUME ["/app/logs", "/app/copy", "/app/backup", "/app/config"]
3639

3740
# Set entrypoint
3841
ENTRYPOINT ["/app/docker-entrypoint.sh"]

0 commit comments

Comments
 (0)