Skip to content

Commit 9d7c39d

Browse files
committed
update deployment container and script
1 parent 12a8009 commit 9d7c39d

File tree

2 files changed

+30
-39
lines changed

2 files changed

+30
-39
lines changed

Dockerfile

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,50 +22,39 @@ SHELL ["/bin/bash", "--login", "-exc"]
2222

2323
WORKDIR /src
2424

25-
RUN <<EOT
26-
# Initial packages
27-
apt-get update -q
28-
apt-get install -qyy \
29-
-o APT::Install-Recommends=false \
30-
-o APT::Install-Suggests=false \
31-
curl ca-certificates gdebi gnupg2 build-essential make git rsync python3-pip
32-
33-
# Download NodeJS
34-
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
35-
apt-get update -q
36-
apt-get install -qyy \
37-
-o APT::Install-Recommends=false \
38-
-o APT::Install-Suggests=false \
39-
nodejs
40-
41-
# Install Hugo static site generator
42-
curl -o hugo.deb -L https://github.com/gohugoio/hugo/releases/download/v${HUGO}/hugo_extended_${HUGO}_linux-amd64.deb
43-
gdebi --non-interactive hugo.deb
44-
rm hugo.deb
45-
46-
# Cleanup
47-
apt-get clean
48-
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
49-
50-
# Ensure user and group exists
51-
groupadd --non-unique -g ${GID} -o ${UNAME}
52-
useradd -m --uid ${UID} --gid ${GID} -o -s /bin/bash ${UNAME}
53-
chown -R ${UID}:${GID} /src
54-
55-
EOT
25+
RUN : \
26+
&& apt-get update -q \
27+
&& apt-get install -qyy \
28+
-o APT::Install-Recommends=false \
29+
-o APT::Install-Suggests=false \
30+
curl ca-certificates gdebi gnupg2 build-essential \
31+
make git rsync python3-pip \
32+
&& (curl -fsSL https://deb.nodesource.com/setup_22.x | bash -) \
33+
&& apt-get update -q \
34+
&& apt-get install -qyy \
35+
-o APT::Install-Recommends=false \
36+
-o APT::Install-Suggests=false \
37+
nodejs \
38+
&& curl -o hugo.deb -L https://github.com/gohugoio/hugo/releases/download/v${HUGO}/hugo_extended_${HUGO}_linux-amd64.deb \
39+
&& gdebi --non-interactive hugo.deb \
40+
&& rm hugo.deb \
41+
&& apt-get clean \
42+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
43+
&& groupadd --non-unique -g ${GID} -o ${UNAME} \
44+
&& useradd -m --uid ${UID} --gid ${GID} -o -s /bin/bash ${UNAME} \
45+
&& chown -R ${UID}:${GID} /src \
46+
&& :
5647

5748

5849
USER ${UID}:${GID}
5950

6051
ENV PATH="${PATH}:/home/${UNAME}/.local/bin"
6152

62-
RUN <<EOT
63-
python3 -m pip install \
53+
RUN python3 -m pip install \
6454
--user \
6555
--no-cache-dir \
6656
--break-system-packages \
6757
"arxiv~=2.1.0" \
6858
requests \
6959
unidecode \
7060
ujson
71-
EOT

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ HUGO_PROD_SERVER_ARGS= --gc --minify --disableFastRender
77

88
HUGO_PROD_BUILD_ARGS= --gc --minify --baseURL=$(BASE_URL) --environment production
99

10+
CONTAINER_NAME := sensorlab/hugo
11+
1012
# HELP
1113
# This will output the help for each task
1214
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
@@ -31,7 +33,7 @@ dev: container ## Run Hugo in container with development mode
3133
-v $(shell pwd):/src \
3234
-p=$(PORT):1313 \
3335
--name hugo-builder \
34-
sensorlab/hugo \
36+
$(CONTAINER_NAME) \
3537
hugo server $(HUGO_DEV_SERVER_ARGS) --bind 0.0.0.0
3638

3739

@@ -42,7 +44,7 @@ shell: container ## Run shell inside container
4244
-v $(shell pwd):/src \
4345
-p=$(PORT):1313 \
4446
--name hugo-builder \
45-
sensorlab/hugo
47+
$(CONTAINER_NAME)
4648

4749

4850
cobiss: ## Update COBISS entries with Python scripts
@@ -77,7 +79,7 @@ build: container ## produce public folder with content in container
7779
-e BABEL_ENV=production \
7880
-e HUGO_GA_ID=G-QP8B1RRWGH \
7981
--name hugo-builder \
80-
sensorlab/hugo \
82+
$(CONTAINER_NAME) \
8183
bash -c "make clean && make cobiss && make public && make clean"
8284

8385

@@ -95,9 +97,9 @@ deploy: container ## produce public folder with content in container
9597
-e BABEL_ENV=production \
9698
-e HUGO_GA_ID=G-QP8B1RRWGH \
9799
--name hugo-builder \
98-
sensorlab/hugo \
100+
$(CONTAINER_NAME) \
99101
bash -c "make clean && make cobiss && make public.tmp && make sync && make clean"
100102

101103

102104
container:
103-
docker build -t sensorlab/hugo .
105+
docker build -t $(CONTAINER_NAME) .

0 commit comments

Comments
 (0)