-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
32 lines (24 loc) · 1.36 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
FROM ubuntu:20.04
ARG TARGETPLATFORM
ENV SHELL /bin/bash
ENV GOPATH=/root/go
USER root
RUN apt-get -y update && \
mkdir -p /tmp/sib && \
apt-get install -y lsb-release sudo vim curl git make build-essential
RUN echo "Targetplatform is ${TARGETPLATFORM}"
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then ARCHITECTURE=linux-amd64; elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCHITECTURE=linux-arm64; else exit 1; fi && \
curl https://storage.googleapis.com/golang/go1.22.4.${ARCHITECTURE}.tar.gz -o /tmp/sib/go.${ARCHITECTURE}.tar.gz && \
tar zxpvf /tmp/sib/go.${ARCHITECTURE}.tar.gz -C /usr/local
RUN cd /tmp/sib && \
git clone https://github.com/gohugoio/hugo.git && \
cd hugo && \
/usr/local/go/bin/go install --tags extended && \
echo "#!/bin/bash\ncd /mnt/sib; /root/go/bin/hugo server -w --bind 0.0.0.0 -b http://localhost:8080/ --disableFastRender --appendPort=false" > /tmp/sib/run_local.sh && \
chmod 755 /tmp/sib/run_local.sh && \
echo "#!/bin/bash\necho \"Run 'docker exec -it sib_shell /bin/bash'\"\n echo \"Press [CTRL+C] to stop..\"\nwhile true\ndo\n sleep 1\ndone" > /tmp/sib/run_shell.sh && \
chmod 755 /tmp/sib/run_shell.sh && \
echo "#!/bin/bash\ncd /mnt/sib; /root/go/bin/hugo && /root/go/bin/hugo deploy\n" > /tmp/sib/deploy.sh && \
chmod 755 /tmp/sib/deploy.sh
CMD ["/bin/bash"]
ENTRYPOINT ["/bin/bash", "-c"]