Skip to content

Commit

Permalink
start of mostly stock build ("no-cache" variant) and deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
traceypooh committed Jan 7, 2024
0 parents commit 810230b
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git*
Dockerfile
default.conf
57 changes: 57 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Hello Folks
on: [workflow_dispatch]
jobs:
greeting:
runs-on: ubuntu-latest
steps:
# this is like https://github.com/internetarchive/build/blob/main/action.yml
# BUT with `cache-to` and `cache-from` removed` (and the `password` field below isnt an input)
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ghcr.io
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: ghcr.io/${{ github.repository }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}



- name: deploy
uses: internetarchive/deploy@v1
with:
BASE_DOMAIN: 'dev.archive.org'
NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NOMAD_VAR_HOSTNAMES: '["testy"]'
NOMAD_VAR_COUNT: 1
NOMAD_VAR_PORTS: '{ 80 = "http" }'
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM nginx:alpine

WORKDIR /usr/share/nginx/html

RUN rm -f index.html && \
# xxx not great for files that dont end like: .js.gz .wasm.gz
sed -i 's/js;/js gz;/' /etc/nginx/mime.types

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

COPY . .
36 changes: 36 additions & 0 deletions default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
server {
listen 80;
server_name localhost;

# enable gzip compression of simple text files when transmitting to clients
# that can handle gzip/deflate responses.
# do not gzip json files because range requests to .json files made by browser js
# applications like archive.org/details/webshots-freeze-frame-index get whole object,
# not the range
gzip on;
gzip_types "text/html; charset=utf-8" text/html text/plain text/javascript application/x-javascript application/javascript text/css text/csv text/xml application/xml;

# add charset info to Content-Type header for text files
# by default, will apply to files with the following mime types:
# text/(plain|html|xml|vnd.wap.wml), application/(javascript|rss+xml)
# if we wish to apply it to additional mime types (say, application/json), we can add a charset_types directive
# see https://nginx.org/en/docs/http/ngx_http_charset_module.html for more details
charset utf-8;

location / {
root /usr/share/nginx/html;
index index.html index.htm;

# customizations:
autoindex on;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
add_header Access-Control-Allow-Headers Accept-Encoding,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,DNT,Pragma,Range,X-Requested-With;
add_header Vary Origin;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Binary file added glogo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 810230b

Please sign in to comment.