First commit.

master
Thomas BELLEMBOIS 2 years ago
commit 5cf84f5e2c

@ -0,0 +1,20 @@
kind: pipeline
type: docker
name: build
trigger:
event:
- push
steps:
- name: docker-build
image: plugins/docker
settings:
dockerfile: Dockerfile
context: .
registry: hub.codefirst.iut.uca.fr
repo: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docnginx
username:
from_secret: SECRET_REGISTRY_USERNAME
password:
from_secret: SECRET_REGISTRY_PASSWORD

@ -0,0 +1,29 @@
FROM nginx:1.21-alpine
RUN apk update && apk add --no-cache openssh rsync shadow
COPY default.conf /etc/nginx/conf.d/
# https://stackoverflow.com/questions/61833713/how-to-login-by-ssh-in-alpine-linux-without-passwords
# https://superuser.com/questions/1633085/dockerfile-clone-repo-with-passwordless-private-key-errors-authentication-ag
RUN echo -n "root:dummy_passwd" | chpasswd
RUN echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config
RUN mkdir /root/.ssh
COPY ./id_rsa /root/.ssh/
COPY ./id_rsa.pub /root/.ssh/
RUN cat /root/.ssh/id_rsa.pub > /root/.ssh/authorized_keys
RUN chmod 700 /root/.ssh && chmod 600 /root/.ssh/*
ADD buildIndex.sh /root/buildIndex.sh
ADD crontab.txt /crontab.txt
RUN chmod +x /root/buildIndex.sh
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
EXPOSE 22 80
ENTRYPOINT ["/entrypoint.sh"]

@ -0,0 +1,36 @@
#!/usr/bin/env sh
INPUT=/usr/share/nginx/html/
OUTPUT=/usr/share/nginx/html/index.html
HTML_TOP=$(cat << EOF
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Code#0 documentation</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
margin: 0px;
}
</style>
<body>
<h5>Page updated every 5 minute.</h5>
<ul>
EOF
)
HTML_BOTTOM=$(cat << EOF
</ul>
</body>
</html>
EOF
)
echo $HTML_TOP > $OUTPUT
cd $INPUT
for d in */ ; do
echo "<li><a href=\"$d\">"$d"</a></li>" >> $OUTPUT
done
echo $HTML_BOTTOM >> $OUTPUT

@ -0,0 +1 @@
*/5 * * * * (/root/buildIndex.sh >> /dev/null 2>&1)

@ -0,0 +1,18 @@
server {
listen 80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
autoindex on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

@ -0,0 +1,14 @@
#!/usr/bin/env sh
ssh-keygen -A
echo "Starting sshd:"
/usr/sbin/sshd -e "$@"
echo "Running crontab."
/usr/bin/crontab /crontab.txt &
/usr/sbin/crond -f -l 2 &
echo "Starting nginx in non daemon mode:"
chown -R nginx:nginx /usr/share/nginx
/usr/sbin/nginx -g 'daemon off;'

@ -0,0 +1,38 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEA6rQj4YwSJKTQwZAg6eAC3V8FodUCpt1ODUlLRFiiDoiDCEVBAsj+
ntH/kAd7vfe+mWgmyFpc97GcecPkPtxzQ8/0nkSYYjnb0M5hTVQiv0xdGk2QOkUUbbaqLZ
cp9lD27uDcxW3CBEuyOIDAZiPbG424QTsNPfjWAszEcMyWoIWVa9Q8RMc6M4SuXSXGmTtz
esRLxZ+jYg0mnpTbNxaIGhdgpmnEWknTYHqzgaISRhxica8yces/DlW/qqnNO5CQosBIWB
tWQiakG5e/9g5vDqPO8ie8HF1JvabOAIwTeVif3/3kIf0bGeClxy5X8WvF+QwEToLUCtsX
XVCPv09VmDMgIOPwjAABQfbq/zwImOsxIN70ZsDUaE2Q2neptpAqyfxav8+XcFclMkdQyt
jSYjvpGpiW1iIosfl2uQVXgb8pBx8EryZtTIcvyc0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