# Stage 1FROM alpine:latest AS build# Install the Hugo go app.RUN apk add --update hugoRUN apk add --update gitWORKDIR /opt/HugoApp# Copy Hugo config into the container Workdir.COPY . .RUN git initRUN git submodule update --init --recursive# Run Hugo in the Workdir to generate HTML.RUN hugo # Stage 2FROM 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 80EXPOSE 80/tcp
name:Docker# This workflow uses actions that are not certified by GitHub.# They are provided by a third-party and are governed by# separate terms of service, privacy policy, and support# documentation.on:push:branches:- '**'jobs:build:runs-on:ubuntu-latestpermissions:contents:readpackages:writeid-token:writesteps:- name:Checkout repositoryuses:actions/checkout@v4- name:Set up Docker Buildxuses:docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226# v3.0.0- name:Log into registryid:registry-loginrun:| docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} ${{ secrets.DOCKER_REGISTRY }}- name:Build and push Docker imageid:build-and-pushrun:| docker build . -t "${{ secrets.DOCKER_REGISTRY }}/yourproject/noorraihan-blog:${{ github.ref_name }}"
docker push "${{ secrets.DOCKER_REGISTRY }}/yourproject/iamgename:${{ github.ref_name }}"