
Recherche avancée
Autres articles (87)
-
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Configuration spécifique pour PHP5
4 février 2011, parPHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
Modules spécifiques
Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...) -
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
Sur d’autres sites (5668)
-
How to install ffmpeg on a Windows Dockerhub image ?
18 janvier, par Youssef KharoufiI have a program that executes a ffmpeg command to a video input, copies this video and pastes is in an output directory.


Here is my code in case you would want to duplicate it :


using Renderer.Models;
using System;
using System.IO;
using System.Text.Json;
using System.Threading.Tasks;

public class Program
{
 public static async Task Main(string[] args)
 {
 var result = new DockerTaskResult();
 try
 {
 // Path to the JSON input file
 string jsonInputPath = @"C:\Users\ykharoufi\source\repos\Renderer\Renderer\Json\task.json";

 // Check if the JSON file exists
 if (!File.Exists(jsonInputPath))
 {
 throw new FileNotFoundException($"JSON input file not found at path: {jsonInputPath}");
 }

 // Read the JSON content
 string jsonContent = File.ReadAllText(jsonInputPath);

 try
 {
 // Deserialize the JSON into a DockerTask object
 DockerTask task = JsonSerializer.Deserialize<dockertask>(jsonContent);
 if (task == null)
 {
 throw new Exception("Failed to deserialize the task from JSON.");
 }

 // Validate the input paths
 if (string.IsNullOrEmpty(task.InputFileRepoPath) || !File.Exists(task.InputFileRepoPath))
 {
 throw new Exception($"Input file path is invalid or does not exist: {task.InputFileRepoPath}");
 }

 if (string.IsNullOrEmpty(task.OutputFileRepoPath) || !Directory.Exists(task.OutputFileRepoPath))
 {
 throw new Exception($"Output directory path is invalid or does not exist: {task.OutputFileRepoPath}");
 }

 // Initialize the Docker worker and run the task
 var worker = new DockerWorker();
 var success = await worker.RunDockerTaskAsync(task);

 if (success.Success)
 {
 result.Success = true;
 result.Message = "Command executed successfully!";

 // Check the output directory for files
 if (Directory.Exists(task.OutputFileRepoPath))
 {
 result.OutputFiles = Directory.GetFiles(task.OutputFileRepoPath);
 }
 }
 else
 {
 result.Success = false;
 result.Message = "Failed to execute the command.";
 result.ErrorDetails = success.ErrorDetails;
 }
 }
 catch (JsonException)
 {
 // Handle invalid JSON format
 result.Success = false;
 result.Message = "Invalid JSON format.";
 result.ErrorDetails = "Invalid data entry";
 }
 }
 catch (Exception ex)
 {
 result.Success = false;
 result.Message = "An error occurred during execution.";
 result.ErrorDetails = ex.Message;
 }
 finally
 {
 // Serialize the result to JSON and write to console
 string outputJson = JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true });
 Console.WriteLine(outputJson);
 }
 }
}

 using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
using System.Threading.Tasks;
using Docker.DotNet;
using Docker.DotNet.Models;
using Renderer.Models;

public class DockerWorker
{
 private readonly DockerClient _dockerClient;

 public DockerWorker()
 {
 Console.WriteLine("Initializing Docker client...");
 _dockerClient = new DockerClientConfiguration(
 new Uri("npipe://./pipe/docker_engine")) // Windows Docker URI
 .CreateClient();
 Console.WriteLine("Docker client initialized.");
 }

 public async Task<dockertaskresult> RunDockerTaskAsync(DockerTask task)
 {
 var result = new DockerTaskResult();

 try
 {
 Console.WriteLine("Starting Docker task...");
 Console.WriteLine($"Image: {task.ImageNaming}");
 Console.WriteLine($"Container: {task.ContainerNaming}");
 Console.WriteLine($"Input Path: {task.InputFileRepoPath}");
 Console.WriteLine($"Output Path: {task.OutputFileRepoPath}");
 Console.WriteLine($"Command: {task.CommandDef}");

 // Ensure the Docker image exists
 Console.WriteLine("Checking if Docker image exists...");
 var imageCheckResult = await EnsureImageExists(task.ImageNaming);
 if (!imageCheckResult.Success)
 {
 result.Success = false;
 result.Message = imageCheckResult.Message;
 result.ErrorDetails = imageCheckResult.ErrorDetails;
 return result;
 }
 Console.WriteLine("Docker image verified.");

 // Determine platform
 var platform = await GetImagePlatform(task.ImageNaming);
 Console.WriteLine($"Detected image platform: {platform}");

 // Translate paths
 string inputVolume, outputVolume;
 if (platform == "linux")
 {
 inputVolume = $"{task.InputFileRepoPath.Replace("C:\\", "/mnt/c/").Replace("\\", "/")}:/app/input";
 outputVolume = $"{task.OutputFileRepoPath.Replace("C:\\", "/mnt/c/").Replace("\\", "/")}:/app/output";
 }
 else if (platform == "windows")
 {
 string inputDir = Path.GetFullPath(Path.GetDirectoryName(task.InputFileRepoPath)).TrimEnd('\\');
 string outputDir = Path.GetFullPath(task.OutputFileRepoPath).TrimEnd('\\');

 if (!Directory.Exists(inputDir))
 {
 throw new Exception($"Input directory does not exist: {inputDir}");
 }
 if (!Directory.Exists(outputDir))
 {
 throw new Exception($"Output directory does not exist: {outputDir}");
 }

 inputVolume = $"{inputDir}:C:\\app\\input";
 outputVolume = $"{outputDir}:C:\\app\\output";

 Console.WriteLine($"Input volume: {inputVolume}");
 Console.WriteLine($"Output volume: {outputVolume}");
 }
 else
 {
 throw new Exception($"Unsupported platform: {platform}");
 }

 // Create container
 Console.WriteLine("Creating Docker container...");
 var containerResponse = await _dockerClient.Containers.CreateContainerAsync(new CreateContainerParameters
 {
 Image = task.ImageNaming,
 Name = task.ContainerNaming,
 HostConfig = new HostConfig
 {
 Binds = new List<string> { inputVolume, outputVolume },
 AutoRemove = true
 },
 Cmd = new[] { platform == "linux" ? "bash" : "cmd.exe", "/c", task.CommandDef }
 });

 if (string.IsNullOrEmpty(containerResponse.ID))
 {
 throw new Exception("Failed to create Docker container.");
 }
 Console.WriteLine($"Container created with ID: {containerResponse.ID}");

 // Start container
 Console.WriteLine("Starting container...");
 bool started = await _dockerClient.Containers.StartContainerAsync(containerResponse.ID, new ContainerStartParameters());
 if (!started)
 {
 throw new Exception($"Failed to start container: {task.ContainerNaming}");
 }

 // Wait for container to finish
 Console.WriteLine("Waiting for container to finish...");
 var waitResponse = await _dockerClient.Containers.WaitContainerAsync(containerResponse.ID);

 if (waitResponse.StatusCode != 0)
 {
 Console.WriteLine($"Container exited with error code: {waitResponse.StatusCode}");
 await FetchContainerLogs(containerResponse.ID);
 throw new Exception($"Container exited with non-zero status code: {waitResponse.StatusCode}");
 }

 // Fetch logs
 Console.WriteLine("Fetching container logs...");
 await FetchContainerLogs(containerResponse.ID);

 result.Success = true;
 result.Message = "Docker task completed successfully.";
 return result;
 }
 catch (Exception ex)
 {
 Console.WriteLine($"Error: {ex.Message}");
 result.Success = false;
 result.Message = "An error occurred during execution.";
 result.ErrorDetails = ex.Message;
 return result;
 }
 }

 private async Task<string> GetImagePlatform(string imageName)
 {
 try
 {
 Console.WriteLine($"Inspecting Docker image: {imageName}...");
 var imageDetails = await _dockerClient.Images.InspectImageAsync(imageName);
 Console.WriteLine($"Image platform: {imageDetails.Os}");
 return imageDetails.Os.ToLower();
 }
 catch (Exception ex)
 {
 throw new Exception($"Failed to inspect image: {ex.Message}");
 }
 }

 private async Task<dockertaskresult> EnsureImageExists(string imageName)
 {
 var result = new DockerTaskResult();
 try
 {
 Console.WriteLine($"Pulling Docker image: {imageName}...");
 await _dockerClient.Images.CreateImageAsync(
 new ImagesCreateParameters { FromImage = imageName, Tag = "latest" },
 null,
 new Progress<jsonmessage>()
 );
 result.Success = true;
 result.Message = "Docker image is available.";
 }
 catch (Exception ex)
 {
 result.Success = false;
 result.Message = $"Failed to pull Docker image: {imageName}";
 result.ErrorDetails = ex.Message;
 }
 return result;
 }

 private async Task FetchContainerLogs(string containerId)
 {
 try
 {
 Console.WriteLine($"Fetching logs for container: {containerId}...");
 var logs = await _dockerClient.Containers.GetContainerLogsAsync(
 containerId,
 new ContainerLogsParameters { ShowStdout = true, ShowStderr = true });

 using (var reader = new StreamReader(logs))
 {
 string logLine;
 while ((logLine = await reader.ReadLineAsync()) != null)
 {
 Console.WriteLine(logLine);
 }
 }
 }
 catch (Exception ex)
 {
 Console.WriteLine($"Failed to fetch logs: {ex.Message}");
 }
 }
}

 {
 "ImageNaming": "khuser/windowsimage:latest",
 "ContainerNaming": "custom-worker-container",
 "InputFileRepoPath": "C:/Users/user/source/repos/Renderer/Renderer/wwwroot/audio.mp4",
 "OutputFileRepoPath": "C:/Users/user/Desktop/output/",
 "CommandDef": "ffmpeg -i C:\\app\\input\\audio.mp4 -c copy C:\\app\\output\\copiedAudio.mp4"
</jsonmessage></dockertaskresult></string></string></dockertaskresult></dockertask>


}. My problem is what I get in the output of my program :
Initializing Docker client... Docker client initialized. Starting Docker task... Image: khyoussef/windowsimage:latest Container: custom-worker-container Input Path: C:/Users/ykharoufi/source/repos/Renderer/Renderer/wwwroot/audio.mp4 Output Path: C:/Users/ykharoufi/Desktop/output/ Command: ffmpeg -i C:\app\input\audio.mp4 -c copy C:\app\output\copiedAudio.mp4 Checking if Docker image exists... Pulling Docker image: khyoussef/windowsimage:latest... Docker image verified. Inspecting Docker image: khyoussef/windowsimage:latest... Image platform: windows Detected image platform: windows Input volume: C:\Users\ykharoufi\source\repos\Renderer\Renderer\wwwroot:C:\app\input Output volume: C:\Users\ykharoufi\Desktop\output:C:\app\output Creating Docker container... Container created with ID: 1daca99b3c76bc8c99c1aed7d2c546ae75aedd9aa1feb0f5002e54769390248e Starting container... Waiting for container to finish... Container exited with error code: 1 Fetching logs for container: 1daca99b3c76bc8c99c1aed7d2c546ae75aedd9aa1feb0f5002e54769390248e... @'ffmpeg' is not recognized as an internal or external command, !operable program or batch file. Error: Container exited with non-zero status code: 1 { "Success": false, "Message": "Failed to execute the command.", "ErrorDetails": "Container exited with non-zero status code: 1", "OutputFiles": null }
, This is the Dockerfile I am working with :

`# Use Windows Server Core as the base image
FROM mcr.microsoft.com/windows/server:ltsc2022

# Set the working directory
WORKDIR /app

# Install required tools (FFmpeg and Visual C++ Redistributable)
RUN powershell -Command \
 $ErrorActionPreference = 'Stop'; \
 # Install Visual C++ Redistributable
 Invoke-WebRequest -Uri https://aka.ms/vs/16/release/vc_redist.x64.exe -OutFile vc_redist.x64.exe; \
 Start-Process -FilePath vc_redist.x64.exe -ArgumentList '/install', '/quiet', '/norestart' -NoNewWindow -Wait; \
 Remove-Item -Force vc_redist.x64.exe; \
 # Download FFmpeg
 Invoke-WebRequest -Uri https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n7.1-latest-win64-gpl-7.1.zip -OutFile ffmpeg.zip; \
 # Extract FFmpeg
 Expand-Archive -Path ffmpeg.zip -DestinationPath C:\ffmpeg; \
 Remove-Item -Force ffmpeg.zip; \
 # Debug step: Verify FFmpeg extraction
 Write-Output "FFmpeg extracted to C:\\ffmpeg"; \
 dir C:\ffmpeg; \
 dir C:\ffmpeg\ffmpeg-n7.1-latest-win64-gpl-7.1\bin

# Add FFmpeg to PATH permanently
ENV PATH="C:\\ffmpeg\\ffmpeg-n7.1-latest-win64-gpl-7.1\\bin;${PATH}"

# Verify FFmpeg installation
RUN ["cmd", "/S", "/C", "ffmpeg -version"]

# Copy required files to the container
COPY ./ /app/

# Default to a PowerShell session
CMD ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-NoExit"]
`



. I did build it using this command : docker build -t khuser/windowsimage:latest -f Dockerfile .


-
Revision 34313 : textebrut sur le #NOM_SITE_SPIP
8 janvier 2010, par fil@… — Logtextebrut sur le #NOM_SITE_SPIP
-
Revision 37431 : Désormais, le plugin de mutualisation fait non seulement la mise à jour de ...
19 avril 2010, par real3t@… — LogDésormais, le plugin de mutualisation fait non seulement la mise à jour de SPIP, mais *aussi* la mise à jour des plugins (particulièrement utile pour passer de SPIP 2 à SPIP 2.1 avec des extensions/ )