Skip to content

Commit

Permalink
ISCC migrating to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
criadoperez committed Oct 4, 2024
1 parent 183778d commit 9632160
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions aws/fargate/ddexGenerateISCC/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN apt-get update && apt-get install -y \
libxslt-dev \
zlib1g-dev \
libmagic1 \
exiv2 \
&& apt-get clean

# Install Python packages
Expand Down
10 changes: 2 additions & 8 deletions aws/fargate/ddexGenerateISCC/main.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import os
import json
import boto3
from iscc_sdk import iscc_generate, dirs
import iscc_sdk as idk
import tempfile

# Set HOME to a writable directory before importing iscc_sdk or other modules
os.environ['HOME'] = '/tmp'

# Update all dirs to point to /tmp
dirs.user_data_dir = '/tmp/iscc_sdk/data'
dirs.user_cache_dir = '/tmp/iscc_sdk/cache'
dirs.user_config_dir = '/tmp/iscc_sdk/config'

s3_client = boto3.client('s3')

def process_files(bucket_name, media_files):
Expand All @@ -29,7 +24,7 @@ def process_files(bucket_name, media_files):
s3_client.download_file(bucket_name, s3_key, file_path)

# Generate the ISCC code for the file
iscc_code = iscc_generate(file_path)
iscc_code = idk.code_iscc(file_path)

# Append the file and its ISCC code to the list
iscc_codes.append({
Expand Down Expand Up @@ -69,4 +64,3 @@ def main():

if __name__ == "__main__":
main()

0 comments on commit 9632160

Please sign in to comment.