Skip to content

Commit a9a9c4a

Browse files
Add publish script
Signed-off-by: Lehmann_Fabian <fabian.lehmann@informatik.hu-berlin.de>
1 parent 75ce4cd commit a9a9c4a

File tree

2 files changed

+36
-17
lines changed

2 files changed

+36
-17
lines changed

Dockerfile

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
FROM python:slim
2-
RUN apt update && apt install -y \
3-
vsftpd \
4-
&& rm -rf /var/lib/apt/lists/*
5-
6-
RUN mkdir -p /var/run/vsftpd/empty
7-
8-
COPY vsftpd.conf /etc/vsftpd.conf
9-
10-
USER root
11-
RUN echo 'root:password' | chpasswd
12-
13-
COPY --chown=root:root ftp.py /app/ftp.py
14-
RUN chmod +x /app/ftp.py
15-
16-
WORKDIR /app
17-
1+
FROM python:slim
2+
RUN apt update && apt install -y \
3+
vsftpd \
4+
&& rm -rf /var/lib/apt/lists/*
5+
6+
RUN mkdir -p /var/run/vsftpd/empty
7+
8+
COPY vsftpd.conf /etc/vsftpd.conf
9+
10+
USER root
11+
RUN echo 'root:password' | chpasswd
12+
13+
COPY --chown=root:root ftp.py /app/ftp.py
14+
RUN chmod +x /app/ftp.py
15+
COPY --chown=root:root publish.sh /app/publish.sh
16+
RUN chmod +x /app/publish.sh
17+
18+
ENV PATH="/app:${PATH}"
19+
20+
WORKDIR /app
21+
1822
ENTRYPOINT ["sh","-c","/usr/sbin/vsftpd /etc/vsftpd.conf"]

publish.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
if (( $# < 3 || $# % 2 == 0 )); then
4+
echo "Usage: $0 <command> <src1> <dest1> [<src2> <dest2> ...]" >&2
5+
exit 1
6+
fi
7+
8+
command=$1
9+
shift
10+
11+
for ((i=0; i<$#; i+=2)); do
12+
src="${@:$i+1:1}"
13+
dest="${@:$i+2:1}"
14+
$command "$src" "$dest" || echo "$src $dest" >&2
15+
done

0 commit comments

Comments
 (0)