Skip to content

Commit

Permalink
[ci skip] added docker image to rust docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraccaman committed Sep 22, 2023
1 parent 1fe85fc commit 3e09301
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 24 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
target
!target/doc
.changelog
.github
.vscode
audit
test
wasm_for_tests
genesis
docker
test_fixtures
.changelog
2 changes: 1 addition & 1 deletion .github/workflows/automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- uses: xt0rted/pull-request-comment-branch@v1
if: steps.check.outputs.triggered == 'true'
id: comment-branch
- uses: actions/checkout@v3
- uses: actions/checkout@4v3
if: steps.check.outputs.triggered == 'true'
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name == 'pull_request_target' }}
# From https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target:
# "This event runs in the context of the base of the pull request,
Expand Down Expand Up @@ -84,10 +84,10 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name == 'pull_request_target' }}
with:
ref: ${{ github.event.pull_request.head.sha }}
Expand Down Expand Up @@ -171,10 +171,10 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name == 'pull_request_target' }}
# See comment in build-and-test.yml
with:
Expand Down Expand Up @@ -271,10 +271,10 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name == 'pull_request_target' }}
# See comment in build-and-test.yml
with:
Expand Down Expand Up @@ -380,10 +380,10 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name == 'pull_request_target' }}
# See comment in build-and-test.yml
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name == 'pull_request_target' }}
# See comment in build-and-test.yml
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@4v3
- name: Setup rust nightly
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@4v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down
42 changes: 36 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jobs:
command: cargo run --bin namada_encoding_spec && cd documentation/dev && mdbook build
cache_subkey: dev
cache_version: v1
distribution_id: E6XPP5KFWXJFQ

env:
CARGO_INCREMENTAL: 0
Expand All @@ -52,10 +51,10 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name == 'pull_request_target' }}
# See comment in build-and-test.yml
with:
Expand Down Expand Up @@ -126,10 +125,10 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
uses: actions/checkout@4v3
if: ${{ github.event_name == 'pull_request_target' }}
# See comment in build-and-test.yml
with:
Expand Down Expand Up @@ -163,7 +162,38 @@ jobs:
run: make build-doc
- name: Print sccache stats
if: always()
run: sccache --show-stats
run: sccache --show-stats || true
- name: Stop sccache server
if: always()
run: sccache --stop-server || true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: v0.9.1
- name: Login to private registry
uses: docker/login-action@v1
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ secrets.REGISTRY_URL }}/namada-rust-docs
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest
- name: ${{ matrix.make.name }}
uses: docker/build-push-action@v4
with:
context: .
file: docker/docs/Dockerfile
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@4v3
with:
fetch-depth: 0
- run: git fetch --tags --force origin # WA: https://github.com/actions/checkout/issues/882
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/triggerable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
SCCACHE_BUCKET: namada-sccache-master

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@4v3
with:
ref: ${{ inputs.branch }}
- name: Configure AWS Credentials
Expand Down
12 changes: 12 additions & 0 deletions docker/docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM nginx:alpine

COPY docker/docs/nginx.conf /etc/nginx/conf.d/default.conf

WORKDIR /usr/share/nginx/html
RUN rm -rf ./*

COPY target/doc .

EXPOSE 3000

CMD ["nginx", "-g", "daemon off;"]
15 changes: 15 additions & 0 deletions docker/docs/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
server {
listen 3000;
root /usr/share/nginx/html;

error_page 404 /namada/index.html;

location /stati.files {
add_header Cache-Control "max-age=31536000";
}

location / {
try_files $uri.html $uri /namada/index.html;
add_header Cache-Control "no-cache";
}
}

0 comments on commit 3e09301

Please sign in to comment.