Skip to content

Commit 4159374

Browse files
committed
Adding to GitHub
0 parents  commit 4159374

File tree

10 files changed

+234
-0
lines changed

10 files changed

+234
-0
lines changed

.github/workflows/build.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tags:
7+
description: "Extra Tags: comma,separated"
8+
required: false
9+
release:
10+
types: [published]
11+
12+
env:
13+
REGISTRY: "ghcr.io"
14+
15+
jobs:
16+
build:
17+
name: "Build"
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 25
20+
21+
steps:
22+
- name: "Checkout"
23+
uses: actions/checkout@v4
24+
25+
- name: "Setup Buildx"
26+
uses: docker/setup-buildx-action@v2
27+
with:
28+
platforms: linux/amd64,linux/arm64
29+
30+
- name: "Docker Login"
31+
uses: docker/login-action@v2
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ vars.GHCR_USER }}
35+
password: ${{ secrets.GHCR_PASS }}
36+
37+
- name: "Generate Tags"
38+
id: tags
39+
uses: smashedr/docker-tags-action@master
40+
with:
41+
images: "${{ env.REGISTRY }}/${{ github.repository }}"
42+
extra: ${{ inputs.tags }}
43+
44+
- name: "Build and Push"
45+
uses: docker/build-push-action@v4
46+
with:
47+
context: nginx
48+
platforms: linux/amd64,linux/arm64
49+
push: true
50+
tags: ${{ steps.tags.outputs.tags }}

.github/workflows/tags.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Tags"
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
tags:
9+
name: "Tags"
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
13+
steps:
14+
- name: "Update Tags"
15+
uses: cssnr/update-version-tags-action@v1
16+
with:
17+
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea/
2+
*.iml
3+
.vscode/

.prettierrc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 4,
4+
"semi": false,
5+
"singleQuote": true,
6+
"overrides": [
7+
{
8+
"files": ["**/*.json", "**/*.yaml", "**/*.yml"],
9+
"options": {
10+
"singleQuote": false
11+
}
12+
},
13+
{
14+
"files": ["**/*.json", "**/*.yaml", "**/*.yml"],
15+
"options": {
16+
"tabWidth": 2
17+
}
18+
}
19+
]
20+
}

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[![Build](https://img.shields.io/github/actions/workflow/status/cssnr/docker-nginx-static/build.yaml?logo=github&logoColor=white&label=build)](https://github.com/cssnr/docker-nginx-static/actions/workflows/build.yaml)
2+
[![Tags](https://img.shields.io/github/actions/workflow/status/cssnr/docker-nginx-static/tags.yaml?logo=github&logoColor=white&label=tags)](https://github.com/cssnr/docker-nginx-static/actions/workflows/tags.yaml)
3+
4+
# Docker Nginx Static
5+
6+
Docker Static Web Server
7+
8+
Coming Soon...

build.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
REGISTRY_HOST="ghcr.io"
6+
REGISTRY_USER="smashedr"
7+
REGISTRY_REPO="docker-nginx-static"
8+
9+
if [ -f ".env" ];then
10+
echo "Sourcing Environment: .env"
11+
source ".env"
12+
fi
13+
14+
if [ -z "${VERSION}" ];then
15+
if [ -z "${1}" ];then
16+
read -rp "Version: " VERSION
17+
else
18+
VERSION="${1}"
19+
fi
20+
fi
21+
#if [ -z "${USERNAME}" ];then
22+
# read -rp "Username: " USERNAME
23+
#fi
24+
#if [ -z "${PASSWORD}" ];then
25+
# read -rp "Password: " PASSWORD
26+
#fi
27+
28+
echo "${REGISTRY_HOST}/${REGISTRY_USER}/${REGISTRY_REPO}:${VERSION}"
29+
30+
#docker login --username "${USERNAME}" --password "${PASSWORD}" "${REGISTRY_HOST}"
31+
docker login "${REGISTRY_HOST}"
32+
33+
docker buildx create --use
34+
docker buildx build --platform linux/amd64,linux/arm64 --push \
35+
-t "${REGISTRY_HOST}/${REGISTRY_USER}/${REGISTRY_REPO}:${VERSION}" nginx
36+
37+
#docker push "${REGISTRY_HOST}/${REGISTRY_USER}/${REGISTRY_REPO}:${VERSION}"

docker-compose.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
version: "3.8"
2+
3+
services:
4+
nginx:
5+
build:
6+
context: nginx
7+
image: ghcr.io/smashedr/docker-nginx-static:latest
8+
#environment:
9+
# SUID: 1000
10+
# STATIC: /static
11+
deploy:
12+
mode: global
13+
resources:
14+
limits:
15+
cpus: "1.0"
16+
memory: 25M
17+
volumes:
18+
- static:/static
19+
ports:
20+
- "8000:80"
21+
22+
openssh-server:
23+
image: lscr.io/linuxserver/openssh-server:latest
24+
environment:
25+
- PUID=1000
26+
- PGID=1000
27+
- TZ=Etc/UTC
28+
- SUDO_ACCESS=false
29+
- PASSWORD_ACCESS=true
30+
- USER_NAME=${USER_NAME:-test}
31+
- USER_PASSWORD=${USER_PASSWORD:-test123}
32+
- DOCKER_MODS=linuxserver/mods:openssh-server-rsync
33+
- LOG_STDOUT=true
34+
deploy:
35+
mode: global
36+
resources:
37+
limits:
38+
cpus: "1.0"
39+
memory: 25M
40+
volumes:
41+
- config:/config
42+
- static:/static
43+
ports:
44+
- "${DOCKER_PORT:-2222}:2222"
45+
46+
volumes:
47+
static:
48+
config:

nginx/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM nginx:alpine-slim
2+
3+
LABEL org.opencontainers.image.source="https://github.com/cssnr/docker-nginx-static"
4+
5+
ENV TZ=UTC
6+
7+
COPY nginx.conf /etc/nginx/nginx.conf
8+
9+
COPY --chmod=0755 perms.sh /docker-entrypoint.d/

nginx/nginx.conf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
user nginx;
2+
worker_processes auto;
3+
pid /var/run/nginx.pid;
4+
5+
events {
6+
worker_connections 1024;
7+
}
8+
9+
error_log /dev/stderr warn;
10+
11+
http {
12+
sendfile on;
13+
charset utf-8;
14+
include /etc/nginx/mime.types;
15+
default_type application/octet-stream;
16+
17+
log_format main '$time_local - $http_x_real_ip ($realip_remote_addr) '
18+
'[$status] $body_bytes_sent $remote_user "$request" '
19+
'"$http_referer" "$http_user_agent"';
20+
access_log /dev/stdout main;
21+
22+
server {
23+
listen 80;
24+
location / {
25+
root /static;
26+
autoindex on;
27+
}
28+
}
29+
}

nginx/perms.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env sh
2+
3+
set -e
4+
5+
echo "Running: ${0}"
6+
7+
echo "STATIC: ${STATIC:-/static}"
8+
echo "SUID: ${SUID:-1000}"
9+
10+
echo "Setting Permissions ${SUID:-1000}:${SUID:-1000} on ${STATIC:-/static}"
11+
chown -R "${SUID:-1000}:${SUID:-1000}" "${STATIC:-/static}"
12+
13+
echo "Done"

0 commit comments

Comments
 (0)