-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Docker support for Hugo website
In this commit, we have added Dockerfile for creating a Docker image of Hugo website. We have updated GitHub actions workflow to build and push the Docker image. Additionally, we have added docker-compose file which will help in running the Docker container locally.
- Loading branch information
1 parent
e77e18b
commit 90af309
Showing
3 changed files
with
43 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Stage 1 | ||
FROM alpine:latest AS build | ||
|
||
# Install Go, Hugo, and Git. | ||
RUN apk add --update go hugo git # Added git here | ||
|
||
WORKDIR /opt/HugoApp | ||
|
||
# Copy Hugo config into the container Workdir. | ||
COPY . . | ||
|
||
# Run Hugo in the Workdir to generate HTML. | ||
RUN hugo | ||
|
||
# Stage 2 | ||
FROM nginx:1.25-alpine | ||
|
||
# Set workdir to the NGINX default dir. | ||
WORKDIR /usr/share/nginx/html | ||
|
||
# Copy HTML from previous build into the Workdir. | ||
COPY --from=build /opt/HugoApp/public . | ||
|
||
# Expose port 80 | ||
EXPOSE 80/tcp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: '3.4' | ||
|
||
services: | ||
hugo-nginx: | ||
command: ["nginx", "-g", "daemon off;"] | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- 80:80 |