Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docker): fix missing submodules inside docker-compose #20

Merged
merged 1 commit into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ jobs:

- run:
name: "Install Git"
command: "apk add git"
command: "sh ./scripts/git.sh $BLOG_BUILD_ENV"

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

- run:
name: "Install Hugo"
Expand Down
12 changes: 7 additions & 5 deletions .docker/blog.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ ENV BLOG_PORT=25001
ENV BLOG_INTERFACE=0.0.0.0

ARG BLOG_DIR=app
ARG BLOG_BUILD_ENV=docker

RUN apk update
RUN apk add hugo
RUN apk update && apk add hugo && mkdir ${BLOG_DIR}

RUN mkdir ${BLOG_DIR}
WORKDIR /${BLOG_DIR}

COPY . .

ENTRYPOINT ["./docker-entrypoint.sh"]
RUN sh ./scripts/git.sh ${BLOG_BUILD_ENV} && sh ./scripts/submodules.sh ${BLOG_BUILD_ENV}

ENTRYPOINT ["./scripts/docker-entrypoint.sh"]

CMD ["hugo"]

EXPOSE ${BLOG_PORT}
EXPOSE ${BLOG_PORT}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ In order to the use correct version of Hugo it is **recommended** to use Docker.

2. Update git submodules:
```bash
git submodule update --init --recursive
sh init.sh
```

### 🐳 Containerized Environment
Expand Down
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ services:

build:
context: .
dockerfile: ".docker/blog.Dockerfile"
dockerfile: ".docker/blog.Dockerfile"

args:
BLOG_BUILD_ENV: compose
2 changes: 2 additions & 0 deletions init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
sh ./scripts/submodules.sh "local"
File renamed without changes.
4 changes: 4 additions & 0 deletions scripts/git.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
if [ ! "$1" = "compose" ]; then
apk add git
fi
4 changes: 4 additions & 0 deletions scripts/submodules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
if [ ! "$1" = "compose" ]; then
git submodule update --init --recursive
fi