Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libriciel
Signature
libersign
Commits
0a09f580
Commit
0a09f580
authored
Feb 26, 2020
by
Adrien BRICCHI
Browse files
Dockerfile (first draft)
parent
635552cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Dockerfile
0 → 100644
View file @
0a09f580
# LiberSign
# Copyright (C) 2008-2020 Libriciel SCOP
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
FROM
debian:stretch
RUN
apt-get update
RUN
apt-get
install
-y
wget
WORKDIR
/var/www/parapheur/libersign
ADD
make.sh .
RUN
./make.sh PROD
FROM
nginx:1.17.8-alpine
## Remove default nginx website
RUN
rm
-rf
/usr/share/nginx/html/
*
COPY
--from=0 /var/www/parapheur/libersign /usr/share/nginx/html/
CMD
["nginx", "-g", "daemon off;"]
make.sh
0 → 100755
View file @
0a09f580
#!/bin/bash
LIBERSIGN_PATH
=
/var/www/parapheur/libersign
CHANNEL
=
$1
if
[
"
${
CHANNEL
}
"
==
"PROD"
]
;
then
SERVER_PATH
=
"http://libersign.adullact-projet.fr"
else
SERVER_PATH
=
"http://l33t-k0rn.adullact-projet.fr"
fi
# Go to libersign folder
pushd
${
LIBERSIGN_PATH
}
>
/dev/null
||
exit
# Download the tgz and md5, but first... let me delete them !
rm
libersign2_
${
CHANNEL
}
.tgz /tmp/libersign2_
${
CHANNEL
}
.md5sum
>
/dev/null 2>&1
# Now, get them !
/usr/bin/wget
-q
"
$SERVER_PATH
/libersign2_
$CHANNEL
.tgz"
/usr/bin/wget
-q
"
$SERVER_PATH
/libersign2_
$CHANNEL
.md5sum"
-P
/tmp
# Verify the all things...
if
[
!
-e
libersign2_
${
CHANNEL
}
.tgz
]
then
echo
"Le fichier libersign2_
$CHANNEL
.tgz n'existe pas"
exit
;
fi
if
[
!
-e
/tmp/libersign2_
${
CHANNEL
}
.md5sum
]
then
echo
"Le fichier libersign2_
$CHANNEL
.md5sum n'existe pas"
exit
;
fi
MD5
=
`
md5sum
libersign2_
${
CHANNEL
}
.tgz |
awk
'{print $1}'
`
echo
${
MD5
}
if
[
-z
${
MD5
}
]
then
echo
"PROBLEME MD5SUM null"
exit
;
fi
if
[
${
MD5
}
!=
`
cat
/tmp/libersign2_
${
CHANNEL
}
.md5sum
`
]
then
echo
"PROBLEME MD5SUM DIFFERENT DE CELUI TELECHARGE"
;
exit
;
fi
# Boring verifications done
# Reset the update.json
echo
'{}'
>
update.json
# Reset the update folder
rm
-rf
update
&&
mkdir
update
# Uncompress the tgz to update folder
tar
zxf libersign2_
${
CHANNEL
}
.tgz
-C
update
# Now, deal with the json generation
cd
update
handlefile
()
{
if
[
-s
"
$1
"
]
then
echo
"
$1
"
md5
=
$(
md5sum
"
$1
"
|
cut
-d
' '
-f1
)
json
=
"
$json
\"
$1
\"
:
\"
$md5
\"
"
base64
"
$1
"
>
"
$1
.b64"
fi
}
json
=
"{"
for
file
in
$(
find
-name
'*.jar'
|
sed
-e
"s/
\.\/
//g"
)
;
do
handlefile
"
$file
"
done
json
=
"
$json
}"
json
=
$(
sed
-e
's/" "/", "/g'
<<<
"
$json
"
)
echo
"
$json
"
>
../update.json
# The json file is generated, it's all done now !
# Return to the base directory
popd
>
/dev/null
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment