Added build script

This commit is contained in:
mrinc 2023-07-25 11:30:41 +02:00
parent ed733ba593
commit 5abd56b063
2 changed files with 63 additions and 0 deletions

45
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,45 @@
name: Build And Publish Docker
on:
push:
branches:
- "master"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
hugo-version: ["0.115.4"]
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./
file: ./Dockerfile
platforms: linux/amd64 # ,linux/arm64/v8
push: true
build-args:
HUGO_VERSION=${{ matrix.hugo-version }}
tags: betterweb/hugo:${{ matrix.hugo-version }}-extended

18
Dockerfile Normal file
View file

@ -0,0 +1,18 @@
ARG HUGO_VERSION=0.115.4
FROM golang:1.20.6-bullseye
RUN apt update -y
RUN apt install tar gzip build-essential -y
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs
RUN npm i -g yarn pnpm
RUN mkdir /tmp/temph
RUN mkdir /home/app
WORKDIR /tmp/temph
RUN wget https://github.com/gohugoio/hugo/releases/download/v$HUGO_VERSION/hugo_extended_$HUGO_VERSION_Linux-64bit.tar.gz
RUN tar xf ./hugo_extended_$HUGO_VERSION_Linux-64bit.tar.gz
RUN mv ./hugo /usr/bin/hugo
WORKDIR /home/app
ENTRYPOINT [ "/bin/bash" ]