generated from pixx/chirpy-starter
CI: speed up build
This commit is contained in:
@@ -35,29 +35,11 @@ jobs:
|
|||||||
# If using the 'assets' git submodule from Chirpy Starter, uncomment above
|
# If using the 'assets' git submodule from Chirpy Starter, uncomment above
|
||||||
# (See: https://github.com/cotes2020/chirpy-starter/tree/main/assets)
|
# (See: https://github.com/cotes2020/chirpy-starter/tree/main/assets)
|
||||||
|
|
||||||
- name: Setup Ruby
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
ruby-version: 3.3
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Build site
|
|
||||||
run: bundle exec jekyll b -d "_site${{ steps.pages.outputs.base_path }}"
|
|
||||||
env:
|
|
||||||
JEKYLL_ENV: "production"
|
|
||||||
|
|
||||||
- name: Test site
|
|
||||||
run: |
|
|
||||||
bundle exec htmlproofer _site \
|
|
||||||
\-\-disable-external \
|
|
||||||
\-\-ignore-urls "/^http:\/\/127.0.0.1/,/^http:\/\/0.0.0.0/,/^http:\/\/localhost/"
|
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: |
|
run: |
|
||||||
echo "FROM nginx:alpine" > Dockerfile
|
docker build \
|
||||||
echo "COPY _site /usr/share/nginx/html" >> Dockerfile
|
-t git.pixx.cz/${{ gitea.repository }}:${{ gitea.sha }} \
|
||||||
echo "EXPOSE 80" >> Dockerfile
|
-t git.pixx.cz/${{ gitea.repository }}:latest .
|
||||||
docker build -t ${CI_REGISTRY_IMAGE:-git.pixx.cz/${{ gitea.repository }}}:${{ gitea.sha }} .
|
|
||||||
|
|
||||||
- name: Login to Gitea Container Registry
|
- name: Login to Gitea Container Registry
|
||||||
run: |
|
run: |
|
||||||
@@ -66,8 +48,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Push Docker image
|
- name: Push Docker image
|
||||||
run: |
|
run: |
|
||||||
docker tag ${CI_REGISTRY_IMAGE:-git.pixx.cz/${{ gitea.repository }}}:${{ gitea.sha }} \
|
|
||||||
${CI_REGISTRY_IMAGE:-git.pixx.cz/${{ gitea.repository }}}:latest
|
|
||||||
docker push ${CI_REGISTRY_IMAGE:-git.pixx.cz/${{ gitea.repository }}}:${{ gitea.sha }}
|
docker push ${CI_REGISTRY_IMAGE:-git.pixx.cz/${{ gitea.repository }}}:${{ gitea.sha }}
|
||||||
docker push ${CI_REGISTRY_IMAGE:-git.pixx.cz/${{ gitea.repository }}}:latest
|
docker push ${CI_REGISTRY_IMAGE:-git.pixx.cz/${{ gitea.repository }}}:latest
|
||||||
|
|
||||||
|
|||||||
24
Dockerfile
Normal file
24
Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# --- Stage 1: Build & Test ---
|
||||||
|
FROM ruby:3.3 AS builder
|
||||||
|
|
||||||
|
# Instalace závislostí pro html-proofer (pokud jsou potřeba)
|
||||||
|
RUN apt-get update && apt-get install -y build-essential
|
||||||
|
|
||||||
|
WORKDIR /srv/jekyll
|
||||||
|
COPY Gemfile* ./
|
||||||
|
RUN bundle install
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Samotný build webu
|
||||||
|
RUN JEKYLL_ENV=production bundle exec jekyll build
|
||||||
|
|
||||||
|
# TEST: Pokud htmlproofer skončí chybou, celý Docker build selže
|
||||||
|
RUN bundle exec htmlproofer ./_site \
|
||||||
|
--disable-external \
|
||||||
|
--ignore-urls "/^http:\/\/127.0.0.1/,/^http:\/\/0.0.0.0/,/^http:\/\/localhost/"
|
||||||
|
|
||||||
|
# --- Stage 2: Final Image ---
|
||||||
|
FROM nginx:alpine
|
||||||
|
COPY --from=builder /srv/jekyll/_site /usr/share/nginx/html
|
||||||
|
EXPOSE 80
|
||||||
Reference in New Issue
Block a user