approach
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
7cd7502a9f
commit
fc96038125
|
@ -0,0 +1,8 @@
|
||||||
|
Options +ExecCGI
|
||||||
|
AddHandler cgi-script .pl
|
||||||
|
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteBase /images/
|
||||||
|
RewriteRule ^(.*)$ /cgi-bin/script.pl?nombre=$1 [L,QSA,NC]
|
||||||
|
</IfModule>
|
|
@ -0,0 +1,20 @@
|
||||||
|
FROM httpd:latest
|
||||||
|
|
||||||
|
# Habilita mod_cgi y configura Apache para ejecutar scripts CGI
|
||||||
|
RUN sed -i '/mod_cgi/s/^#//g' /usr/local/apache2/conf/httpd.conf
|
||||||
|
RUN echo "AddHandler cgi-script .cgi .pl" >> /usr/local/apache2/conf/httpd.conf
|
||||||
|
RUN echo "ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin/" >> /usr/local/apache2/conf/httpd.conf
|
||||||
|
RUN chmod -R 755 /usr/local/apache2/cgi-bin/
|
||||||
|
|
||||||
|
# Habilita mod_rewrite
|
||||||
|
RUN sed -i '/mod_rewrite/s/^#//g' /usr/local/apache2/conf/httpd.conf
|
||||||
|
|
||||||
|
# Copia el script CGI al directorio /usr/local/apache2/cgi-bin/
|
||||||
|
COPY cgi-bin/ /usr/local/apache2/cgi-bin/
|
||||||
|
RUN chmod +x /usr/local/apache2/cgi-bin/script.pl
|
||||||
|
|
||||||
|
# Copia las imágenes al directorio htdocs/images
|
||||||
|
COPY images/ /usr/local/apache2/htdocs/images/
|
||||||
|
|
||||||
|
# Copia el archivo .htaccess para configurar el directorio htdocs/images
|
||||||
|
COPY .htaccess /usr/local/apache2/htdocs/images/.htaccess
|
|
@ -0,0 +1,2 @@
|
||||||
|
Options +ExecCGI
|
||||||
|
AddHandler cgi-script .pl
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
print "Content-type: text/html\n\n";
|
||||||
|
print "<html><head><title>Hola Mundo en Perl</title></head><body>";
|
||||||
|
print "<h1>Hola Mundo desde Perl</h1>";
|
||||||
|
print "</body></html>";
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Digest::MD5;
|
||||||
|
|
||||||
|
# Leer el nombre del archivo desde la consulta
|
||||||
|
my $archivo = $ENV{'QUERY_STRING'};
|
||||||
|
|
||||||
|
# Calcular el MD5 del nombre del archivo
|
||||||
|
my $md5 = Digest::MD5->new;
|
||||||
|
$md5->add($archivo);
|
||||||
|
my $hash = $md5->hexdigest;
|
||||||
|
|
||||||
|
# Imprimir el resultado
|
||||||
|
print "Content-type: text/html\n\n";
|
||||||
|
print "<html><head><title>MD5 del nombre del archivo</title></head><body>";
|
||||||
|
print "<h1>MD5 del nombre del archivo: $hash</h1>";
|
||||||
|
print "</body></html>";
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Digest::MD5;
|
||||||
|
use File::Basename;
|
||||||
|
|
||||||
|
sub calcular_hash {
|
||||||
|
my ($archivo) = @_;
|
||||||
|
|
||||||
|
# Obtener solo el nombre del archivo sin la ruta
|
||||||
|
my $nombre_archivo = fileparse($archivo);
|
||||||
|
|
||||||
|
# Calcular el hash MD5 del nombre del archivo
|
||||||
|
my $md5 = Digest::MD5->new;
|
||||||
|
$md5->add($nombre_archivo);
|
||||||
|
my $hash = $md5->hexdigest;
|
||||||
|
|
||||||
|
return $hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Obtener el nombre del archivo de la URL
|
||||||
|
my $archivo_url = $ENV{'REQUEST_URI'};
|
||||||
|
my $hash_archivo = calcular_hash($archivo_url);
|
||||||
|
|
||||||
|
# Imprimir el hash como respuesta
|
||||||
|
print "Content-type: text/plain\n\n";
|
||||||
|
print "Hash del nombre del archivo: $hash_archivo\n";
|
|
@ -0,0 +1,8 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
apache:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
|
@ -15,12 +15,14 @@ for image in "$directorio_principal"/*; do
|
||||||
fileName=$(basename "$image")
|
fileName=$(basename "$image")
|
||||||
imageName="${fileName%.*}"
|
imageName="${fileName%.*}"
|
||||||
hash=$(echo -n "$imageName" | sha1sum | awk '{print $1}')
|
hash=$(echo -n "$imageName" | sha1sum | awk '{print $1}')
|
||||||
|
echo "$(dirname "$image")/${hash:0:2}/${hash:2:2}"
|
||||||
|
|
||||||
path=$(dirname "$image")/${hash:2:2}/${hash:0:2}
|
path=$(dirname "$image")/${hash:2:2}/${hash:0:2}
|
||||||
mkdir -p $path
|
mkdir -p $path
|
||||||
# Crear un enlace simbólico en la carpeta principal
|
# Crear un enlace simbólico en la carpeta principal
|
||||||
ln -s "$image" "$fileName"
|
|
||||||
|
|
||||||
mv $image $path/$fileName
|
mv $image $path/$fileName
|
||||||
|
ln -s "$image" "$1/$fileName"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
# done
|
# done
|
||||||
# fi
|
# fi
|
||||||
|
|
|
@ -6,6 +6,8 @@ for collection in */ ; do
|
||||||
fileName=$(basename "$image")
|
fileName=$(basename "$image")
|
||||||
imageName="${fileName%.*}"
|
imageName="${fileName%.*}"
|
||||||
hash=$(echo -n "$imageName" | sha1sum | awk '{print $1}')
|
hash=$(echo -n "$imageName" | sha1sum | awk '{print $1}')
|
||||||
|
echo $image
|
||||||
|
echo ${hash:2:2}/${hash:0:2}
|
||||||
mkdir -p $(dirname "$image")/${hash:2:2}/${hash:0:2}
|
mkdir -p $(dirname "$image")/${hash:2:2}/${hash:0:2}
|
||||||
ln -s $image $(dirname "$image")/${hash:2:2}/${hash:0:2}/$fileName
|
ln -s $image $(dirname "$image")/${hash:2:2}/${hash:0:2}/$fileName
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue