Skip to content

Commit fccc92a

Browse files
author
Francesco Sardone
authored
fix(docker): fix missing submodules inside docker-compose
1 parent 1708e92 commit fccc92a

File tree

8 files changed

+24
-9
lines changed

8 files changed

+24
-9
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ jobs:
5858

5959
- run:
6060
name: "Install Git"
61-
command: "apk add git"
61+
command: "sh ./scripts/git.sh $BLOG_BUILD_ENV"
6262

6363
- run:
6464
name: "Update Git Submodules"
65-
command: "git submodule update --init --recursive"
65+
command: "sh ./scripts/submodules.sh $BLOG_BUILD_ENV"
6666

6767
- run:
6868
name: "Install Hugo"

.docker/blog.Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@ ENV BLOG_PORT=25001
66
ENV BLOG_INTERFACE=0.0.0.0
77

88
ARG BLOG_DIR=app
9+
ARG BLOG_BUILD_ENV=docker
910

10-
RUN apk update
11-
RUN apk add hugo
11+
RUN apk update && apk add hugo && mkdir ${BLOG_DIR}
1212

13-
RUN mkdir ${BLOG_DIR}
1413
WORKDIR /${BLOG_DIR}
1514

1615
COPY . .
1716

18-
ENTRYPOINT ["./docker-entrypoint.sh"]
17+
RUN sh ./scripts/git.sh ${BLOG_BUILD_ENV} && sh ./scripts/submodules.sh ${BLOG_BUILD_ENV}
18+
19+
ENTRYPOINT ["./scripts/docker-entrypoint.sh"]
20+
1921
CMD ["hugo"]
2022

21-
EXPOSE ${BLOG_PORT}
23+
EXPOSE ${BLOG_PORT}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ In order to the use correct version of Hugo it is **recommended** to use Docker.
1616

1717
2. Update git submodules:
1818
```bash
19-
git submodule update --init --recursive
19+
sh init.sh
2020
```
2121

2222
### 🐳 Containerized Environment

docker-compose.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ services:
2121

2222
build:
2323
context: .
24-
dockerfile: ".docker/blog.Dockerfile"
24+
dockerfile: ".docker/blog.Dockerfile"
25+
26+
args:
27+
BLOG_BUILD_ENV: compose

init.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
sh ./scripts/submodules.sh "local"
File renamed without changes.

scripts/git.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
if [ ! "$1" = "compose" ]; then
3+
apk add git
4+
fi

scripts/submodules.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
if [ ! "$1" = "compose" ]; then
3+
git submodule update --init --recursive
4+
fi

0 commit comments

Comments
 (0)