forked from zalando/tech-radar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Dockerfile and configuration for deployment (#14)
- Loading branch information
Showing
3 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Build Container | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
required: true | ||
description: 'Version string, e.g. 1.2.5:' | ||
|
||
concurrency: | ||
cancel-in-progress: false | ||
group: build-docker-images | ||
|
||
jobs: | ||
tag_version: | ||
name: Create Tag for Version ${{ github.event.inputs.version }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.ref_name }} | ||
|
||
- name: Create and Push Tag | ||
run: | | ||
git config --local user.name "github-actions[bot]" | ||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git remote add publish "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" | ||
git fetch publish | ||
git tag "${{ github.event.inputs.version }}" | ||
git push publish --tags | ||
build_container: | ||
name: Build Container (linux/amd64) | ||
runs-on: ubuntu-latest | ||
needs: tag_version | ||
permissions: | ||
contents: read | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to Dockerhub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Set up Docker BuildX | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
version: latest | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: true | ||
platforms: linux/amd64 | ||
context: '.' | ||
tags: | | ||
techradar:latest | ||
techradar:${{ github.event.inputs.version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM curlimages/curl:latest AS builder | ||
WORKDIR /downloads | ||
|
||
# download d3 and replace the download url in the index file | ||
COPY docs/index.html index.html | ||
RUN curl -L --no-progress-meter -o d3.js https://d3js.org/d3.v4.min.js | ||
RUN sed -i 's|<script src="https://d3js.org/d3.v4.min.js"></script>|<script src="d3.js"></script>|' index.html | ||
|
||
# download nginx prometheus exporter | ||
ARG NGINX_EXPORTER_VERSION=1.3.0 | ||
RUN curl -L --no-progress-meter -o nginx-prometheus-exporter.tar.gz https://github.com/nginxinc/nginx-prometheus-exporter/releases/download/v${NGINX_EXPORTER_VERSION}/nginx-prometheus-exporter_${NGINX_EXPORTER_VERSION}_linux_amd64.tar.gz && \ | ||
tar -xzvf nginx-prometheus-exporter.tar.gz && \ | ||
chmod +x nginx-prometheus-exporter | ||
|
||
FROM nginxinc/nginx-unprivileged:stable-alpine | ||
COPY deployment/nginx.conf /etc/nginx/conf.d/default.conf | ||
COPY docs/*.js /usr/share/nginx/html/ | ||
COPY docs/*.css /usr/share/nginx/html/ | ||
COPY --from=builder /downloads/d3.js /usr/share/nginx/html/d3.js | ||
COPY --from=builder /downloads/index.html /usr/share/nginx/html/index.html | ||
COPY --from=builder /downloads/nginx-prometheus-exporter /usr/local/bin/nginx-prometheus-exporter | ||
|
||
CMD ["sh", "-c", "nginx -g 'daemon off;' & nginx-prometheus-exporter --web.listen-address=:9113"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
server { | ||
listen 8080; | ||
server_name techradar.easybill.com; | ||
|
||
sendfile on; | ||
server_tokens off; | ||
keepalive_timeout 30s; | ||
|
||
index index.html; | ||
root /usr/share/nginx/html; | ||
|
||
location / { | ||
try_files $uri $uri/ =404; | ||
} | ||
|
||
location /health { | ||
access_log off; | ||
return 200 ''; | ||
} | ||
|
||
location /stub_status { | ||
allow 127.0.0.1; | ||
deny all; | ||
stub_status; | ||
access_log off; | ||
} | ||
} |