Skip to content

Add Docker support with Hugo and Node.js setup #84

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HUGO_VERSION=0.136.5-ext-ubuntu
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ARG HUGO_VERSION

FROM floryn90/hugo:${HUGO_VERSION}

# Switch to root user to install dependencies
USER root

# Install Node.js and npm
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get -yq update && apt-get -yq upgrade && apt-get install -yq nodejs && npm --version

# Set the working directory
WORKDIR /src

# Install npm dependencies
COPY package.json package-lock.json ./
RUN npm install

# Copy the rest of your app's source code
COPY . .

# Set permissions for the /src directory
RUN chown -R hugo:hugo /src

# Switch back to the original user
# USER hugo

CMD ["hugo", "server", "-D", "-F"]
18 changes: 18 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
services:
server:
# build:
# context: .
# dockerfile: Dockerfile
# args:
# HUGO_VERSION: ${HUGO_VERSION}
image: floryn90/hugo:${HUGO_VERSION}
command: ["server", "-D", "-F"]
volumes:
- ".:/src"
ports:
- "1313:1313"
deploy:
resources:
limits:
cpus: '2'
memory: 512M
Loading