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

Commit cc7f9be

Browse files
committed
Switch deployment to Docker
1 parent dc85673 commit cc7f9be

File tree

5 files changed

+115
-17
lines changed

5 files changed

+115
-17
lines changed

.github/workflows/deploy.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,29 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v2
1313

14-
- name: Setup ruby
15-
uses: ruby/setup-ruby@v1
14+
- uses: ruby/setup-ruby@v1
1615
with:
1716
bundler-cache: true
18-
- name: Install ruby dependencies
19-
run: bundle install
20-
- name: Bulid with middleman
21-
run: bundle exec middleman build
17+
- run: bundle install
18+
- run: bundle exec middleman build
2219

23-
- name: Deploy
24-
run: |
25-
mkdir -p ~/.ssh
26-
ssh-keyscan webapps.flathub.org >> ~/.ssh/known_hosts
27-
eval "$(ssh-agent -s)"
28-
ssh-add - <<< "${DEPLOY_KEY}"
29-
rsync -rP --delete build/ [email protected]:
30-
env:
31-
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
20+
- uses: docker/setup-buildx-action@v2
21+
- uses: docker/login-action@v2
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- uses: docker/build-push-action@v3
28+
with:
29+
file: Dockerfile
30+
push: ${{ github.event_name != 'pull_request' }}
31+
tags: |
32+
ghcr.io/flatpak/flatpak.github.io:${{ github.sha }}
33+
ghcr.io/flatpak/flatpak.github.io:latest
34+
labels: |
35+
org.opencontainers.image.revision=${{ github.sha }}
36+
org.opencontainers.image.source=ssh://[email protected]:${{ github.repository }}.git
37+
org.opencontainers.image.url=https://github.com/${{ github.repository }}
38+
cache-from: type=gha
39+
cache-to: type=gha,mode=max

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.6.5
1+
3.0.4

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ARG RUBY_VERSION
2+
FROM docker.io/library/ruby:$RUBY_VERSION AS build
3+
4+
WORKDIR /builddir
5+
COPY . .
6+
RUN bundle install --deployment
7+
RUN bundle exec middleman build
8+
9+
FROM docker.io/nginxinc/nginx-unprivileged:stable
10+
COPY --from=build /builddir/build /srv/http/
11+
ADD nginx.conf /etc/nginx/conf.d/default.conf

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
source 'https://rubygems.org'
22

33
gem "middleman", "~> 4"#, github: "middleman/middleman", branch: "v3-stable"
4-
gem "matomo-middleman", github: "flatpak/middleman-matomo"
4+
gem "matomo-middleman", git: "https://github.com/flatpak/middleman-matomo"
55
#gem "middleman-blog"
66
gem "middleman-livereload" #3.1.0
77
gem "nokogiri" #1.6.0 (xml html smarts)

nginx.conf

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
charset_types
2+
text/css
3+
text/plain
4+
text/vnd.wap.wml
5+
application/javascript
6+
application/json
7+
application/rss+xml
8+
application/xml;
9+
10+
tcp_nopush on;
11+
gzip on;
12+
gzip_comp_level 5;
13+
gzip_proxied any;
14+
gzip_vary on;
15+
16+
gzip_types
17+
application/atom+xml
18+
application/javascript
19+
application/json
20+
application/ld+json
21+
application/manifest+json
22+
application/rss+xml
23+
application/vnd.geo+json
24+
application/vnd.ms-fontobject
25+
application/x-font-ttf
26+
application/x-web-app-manifest+json
27+
application/xhtml+xml
28+
application/xml
29+
font/opentype
30+
image/bmp
31+
image/svg+xml
32+
image/x-icon
33+
text/cache-manifest
34+
text/css
35+
text/plain
36+
text/vcard
37+
text/vnd.rim.location.xloc
38+
text/vtt
39+
text/x-component
40+
text/x-cross-domain-policy;
41+
42+
server {
43+
listen 8080 default_server;
44+
server_name _;
45+
46+
root /srv/http/;
47+
try_files $uri $uri/ $uri.html =404;
48+
error_page 404 /404.html;
49+
50+
rewrite ^/setup/(.*)/ https://flatpak.org/setup/$1;
51+
52+
location /apps.html {
53+
return 301 https://flathub.org/;
54+
}
55+
56+
location /developer.html {
57+
return 301 http://docs.flatpak.org/en/latest/;
58+
}
59+
60+
location /getting.html {
61+
return 301 /setup/;
62+
}
63+
64+
location /hello-world.html {
65+
return 301 http://docs.flatpak.org/en/latest/getting-started.html;
66+
}
67+
68+
location /runtimes.html {
69+
return 301 http://docs.flatpak.org/en/latest/available-runtimes.html;
70+
}
71+
72+
# Some flatpak images are compressed SVG files. Skip compressing
73+
# them again but tell clients that they're already compressed since
74+
# many browsers don't know that svgz is compressed.
75+
location ~* \.svgz$ {
76+
gzip off;
77+
add_header Content-Encoding "gzip";
78+
}
79+
}

0 commit comments

Comments
 (0)