Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
Switch deployment to Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
barthalion committed Jun 8, 2022
1 parent dc85673 commit cc7f9be
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 17 deletions.
38 changes: 23 additions & 15 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,29 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup ruby
uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Install ruby dependencies
run: bundle install
- name: Bulid with middleman
run: bundle exec middleman build
- run: bundle install
- run: bundle exec middleman build

- name: Deploy
run: |
mkdir -p ~/.ssh
ssh-keyscan webapps.flathub.org >> ~/.ssh/known_hosts
eval "$(ssh-agent -s)"
ssh-add - <<< "${DEPLOY_KEY}"
rsync -rP --delete build/ [email protected]:
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@v3
with:
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
ghcr.io/flatpak/flatpak.github.io:${{ github.sha }}
ghcr.io/flatpak/flatpak.github.io:latest
labels: |
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=ssh://[email protected]:${{ github.repository }}.git
org.opencontainers.image.url=https://github.com/${{ github.repository }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.5
3.0.4
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG RUBY_VERSION
FROM docker.io/library/ruby:$RUBY_VERSION AS build

WORKDIR /builddir
COPY . .
RUN bundle install --deployment
RUN bundle exec middleman build

FROM docker.io/nginxinc/nginx-unprivileged:stable
COPY --from=build /builddir/build /srv/http/
ADD nginx.conf /etc/nginx/conf.d/default.conf
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'

gem "middleman", "~> 4"#, github: "middleman/middleman", branch: "v3-stable"
gem "matomo-middleman", github: "flatpak/middleman-matomo"
gem "matomo-middleman", git: "https://github.com/flatpak/middleman-matomo"
#gem "middleman-blog"
gem "middleman-livereload" #3.1.0
gem "nokogiri" #1.6.0 (xml html smarts)
Expand Down
79 changes: 79 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
charset_types
text/css
text/plain
text/vnd.wap.wml
application/javascript
application/json
application/rss+xml
application/xml;

tcp_nopush on;
gzip on;
gzip_comp_level 5;
gzip_proxied any;
gzip_vary on;

gzip_types
application/atom+xml
application/javascript
application/json
application/ld+json
application/manifest+json
application/rss+xml
application/vnd.geo+json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/bmp
image/svg+xml
image/x-icon
text/cache-manifest
text/css
text/plain
text/vcard
text/vnd.rim.location.xloc
text/vtt
text/x-component
text/x-cross-domain-policy;

server {
listen 8080 default_server;
server_name _;

root /srv/http/;
try_files $uri $uri/ $uri.html =404;
error_page 404 /404.html;

rewrite ^/setup/(.*)/ https://flatpak.org/setup/$1;

location /apps.html {
return 301 https://flathub.org/;
}

location /developer.html {
return 301 http://docs.flatpak.org/en/latest/;
}

location /getting.html {
return 301 /setup/;
}

location /hello-world.html {
return 301 http://docs.flatpak.org/en/latest/getting-started.html;
}

location /runtimes.html {
return 301 http://docs.flatpak.org/en/latest/available-runtimes.html;
}

# Some flatpak images are compressed SVG files. Skip compressing
# them again but tell clients that they're already compressed since
# many browsers don't know that svgz is compressed.
location ~* \.svgz$ {
gzip off;
add_header Content-Encoding "gzip";
}
}

0 comments on commit cc7f9be

Please sign in to comment.