Compare commits
2 Commits
07b6ba2ae5
...
dfffae35b2
Author | SHA1 | Date | |
---|---|---|---|
|
dfffae35b2 | ||
|
cc07af72c5 |
32
.drone.yml
Normal file
32
.drone.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: publish pipeline
|
||||||
|
steps:
|
||||||
|
- name: publish jekyll container
|
||||||
|
image: plugins/docker
|
||||||
|
settings: &docker-build-settings
|
||||||
|
username: 3wordchant
|
||||||
|
password:
|
||||||
|
from_secret: git_autonomic_zone_token_3wc
|
||||||
|
repo: git.autonomic.zone/autonomic-cooperative/kcl-site
|
||||||
|
auto_tag: true
|
||||||
|
registry: git.autonomic.zone
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- custom
|
||||||
|
|
||||||
|
- name: deploy-site
|
||||||
|
image: git.coopcloud.tech/coop-cloud/docker-cp-deploy:latest
|
||||||
|
settings:
|
||||||
|
host: small-clients.autonomic.zone
|
||||||
|
service: kcl_autonomic_zone_app
|
||||||
|
source: /srv/jekyll/dist/
|
||||||
|
dest: /usr/share/nginx/html/
|
||||||
|
exec_pre: rm -rf /usr/share/nginx/html/*
|
||||||
|
deploy_key:
|
||||||
|
from_secret: drone_ssh_swarm-demo.autonomic.zone
|
||||||
|
depends_on:
|
||||||
|
- publish-jekyll-container
|
35
Dockerfile
Normal file
35
Dockerfile
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# Stage 1: Build the Jekyll site
|
||||||
|
FROM ruby:3.0.0 AS builder
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
git \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install the specific version of Bundler
|
||||||
|
RUN gem install bundler:2.2.13
|
||||||
|
|
||||||
|
WORKDIR /srv/jekyll
|
||||||
|
|
||||||
|
# Copy Gemfile and Gemfile.lock and install dependencies
|
||||||
|
COPY Gemfile Gemfile.lock ./
|
||||||
|
RUN bundle _2.2.13_ install
|
||||||
|
|
||||||
|
# Copy the rest of the application files
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the Jekyll site
|
||||||
|
RUN jekyll build -d /dist
|
||||||
|
|
||||||
|
# Stage 2: Serve the Jekyll site using Nginx
|
||||||
|
FROM nginx:1.26.0
|
||||||
|
|
||||||
|
WORKDIR /usr/share/nginx/html
|
||||||
|
|
||||||
|
# Copy the generated site from the builder stage
|
||||||
|
COPY --from=builder /dist .
|
||||||
|
|
||||||
|
# Expose port 80 for the web server
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
30
Dockerfile.dev
Normal file
30
Dockerfile.dev
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
FROM ruby:3.0.0 as jekyll
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
git \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# used in the jekyll-server image, which is FROM this image
|
||||||
|
COPY docker-entrypoint.sh /usr/local/bin/
|
||||||
|
|
||||||
|
RUN gem update --system && gem install jekyll && gem cleanup
|
||||||
|
|
||||||
|
EXPOSE 4000
|
||||||
|
|
||||||
|
WORKDIR /site
|
||||||
|
|
||||||
|
ENTRYPOINT [ "jekyll" ]
|
||||||
|
|
||||||
|
CMD [ "--help" ]
|
||||||
|
|
||||||
|
# build from the image we just built with different metadata
|
||||||
|
FROM jekyll as jekyll-serve
|
||||||
|
|
||||||
|
COPY --from=jekyll /usr/local/bin/docker-entrypoint.sh /usr/local/bin/
|
||||||
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||||
|
|
||||||
|
# on every container start, check if Gemfile exists and warn if it's missing
|
||||||
|
ENTRYPOINT [ "docker-entrypoint.sh" ]
|
||||||
|
|
||||||
|
CMD [ "bundle", "exec", "jekyll", "serve", "--force_polling", "-H", "0.0.0.0", "-P", "4000" ]
|
2
Gemfile
2
Gemfile
@ -33,3 +33,5 @@ gem 'wdm', '~> 0.1.1', platforms: %i[mingw x64_mingw mswin]
|
|||||||
gem 'html-proofer', '~> 3.19'
|
gem 'html-proofer', '~> 3.19'
|
||||||
|
|
||||||
gem 'rake', '~> 13.0'
|
gem 'rake', '~> 13.0'
|
||||||
|
|
||||||
|
gem 'webrick'
|
||||||
|
@ -99,6 +99,7 @@ GEM
|
|||||||
typhoeus (1.4.0)
|
typhoeus (1.4.0)
|
||||||
ethon (>= 0.9.0)
|
ethon (>= 0.9.0)
|
||||||
unicode-display_width (1.7.0)
|
unicode-display_width (1.7.0)
|
||||||
|
webrick (1.8.1)
|
||||||
yell (2.2.2)
|
yell (2.2.2)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
@ -115,6 +116,7 @@ DEPENDENCIES
|
|||||||
tzinfo (~> 1.2)
|
tzinfo (~> 1.2)
|
||||||
tzinfo-data
|
tzinfo-data
|
||||||
wdm (~> 0.1.1)
|
wdm (~> 0.1.1)
|
||||||
|
webrick
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.2.13
|
2.2.13
|
||||||
|
9
docker-compose.dev.yml
Normal file
9
docker-compose.dev.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# no version needed since 2020
|
||||||
|
|
||||||
|
services:
|
||||||
|
jekyll:
|
||||||
|
image: git.autonomic.zone/autonomic-cooperative/kcl-site-dev:latest
|
||||||
|
volumes:
|
||||||
|
- .:/site
|
||||||
|
ports:
|
||||||
|
- '4000:4000'
|
37
docker-compose.yml
Normal file
37
docker-compose.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: git.autonomic.zone/autonomic-cooperative/kcl-site:latest
|
||||||
|
networks:
|
||||||
|
- proxy
|
||||||
|
volumes:
|
||||||
|
- html_content:/usr/share/nginx/html
|
||||||
|
configs:
|
||||||
|
- source: nginx_conf
|
||||||
|
target: /etc/nginx/nginx.conf
|
||||||
|
deploy:
|
||||||
|
update_config:
|
||||||
|
failure_action: rollback
|
||||||
|
order: start-first
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.services.${STACK_NAME}-jekyll.loadbalancer.server.port=80"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}-jekyll.rule=Host(`${DOMAIN}`)"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}-jekyll.entrypoints=web-secure"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}-jekyll.tls.certresolver=production"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
proxy:
|
||||||
|
external: true
|
||||||
|
internal:
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
html_content:
|
||||||
|
|
||||||
|
configs:
|
||||||
|
nginx_conf:
|
||||||
|
name: ${STACK_NAME}_nginx_conf_${NGINX_CONF_VERSION}
|
||||||
|
file: nginx.conf
|
||||||
|
template_driver: golang
|
19
docker-entrypoint.sh
Normal file
19
docker-entrypoint.sh
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ ! -f Gemfile ]; then
|
||||||
|
echo "NOTE: hmm, I don't see a Gemfile so I don't think there's a jekyll site here"
|
||||||
|
echo "Either you didn't mount a volume, or you mounted it incorrectly."
|
||||||
|
echo "Be sure you're in your jekyll site root and use something like this to launch"
|
||||||
|
echo ""
|
||||||
|
echo "docker run -p 4000:4000 -v \$(pwd):/site bretfisher/jekyll-serve"
|
||||||
|
echo ""
|
||||||
|
echo "NOTE: To create a new site, you can use the sister image bretfisher/jekyll like:"
|
||||||
|
echo ""
|
||||||
|
echo "docker run -v \$(pwd):/site bretfisher/jekyll new ."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
bundle install --retry 5 --jobs 20
|
||||||
|
|
||||||
|
exec "$@"
|
36
nginx.conf
Normal file
36
nginx.conf
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
gzip on;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_proxied any;
|
||||||
|
gzip_comp_level 6;
|
||||||
|
gzip_buffers 16 8k;
|
||||||
|
gzip_http_version 1.1;
|
||||||
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /error_page.html {
|
||||||
|
internal;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.(jpg|jpeg|png|gif|ico|css|js|htm|html)$ {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
expires 30d;
|
||||||
|
add_header Pragma public;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 404 /error_page.html;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user