-
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.
- Loading branch information
0 parents
commit 4159374
Showing
10 changed files
with
234 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,50 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tags: | ||
description: "Extra Tags: comma,separated" | ||
required: false | ||
release: | ||
types: [published] | ||
|
||
env: | ||
REGISTRY: "ghcr.io" | ||
|
||
jobs: | ||
build: | ||
name: "Build" | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 25 | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Setup Buildx" | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
- name: "Docker Login" | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ vars.GHCR_USER }} | ||
password: ${{ secrets.GHCR_PASS }} | ||
|
||
- name: "Generate Tags" | ||
id: tags | ||
uses: smashedr/docker-tags-action@master | ||
with: | ||
images: "${{ env.REGISTRY }}/${{ github.repository }}" | ||
extra: ${{ inputs.tags }} | ||
|
||
- name: "Build and Push" | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: nginx | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.tags.outputs.tags }} |
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,17 @@ | ||
name: "Tags" | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
tags: | ||
name: "Tags" | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: "Update Tags" | ||
uses: cssnr/update-version-tags-action@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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,3 @@ | ||
.idea/ | ||
*.iml | ||
.vscode/ |
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,20 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 4, | ||
"semi": false, | ||
"singleQuote": true, | ||
"overrides": [ | ||
{ | ||
"files": ["**/*.json", "**/*.yaml", "**/*.yml"], | ||
"options": { | ||
"singleQuote": false | ||
} | ||
}, | ||
{ | ||
"files": ["**/*.json", "**/*.yaml", "**/*.yml"], | ||
"options": { | ||
"tabWidth": 2 | ||
} | ||
} | ||
] | ||
} |
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,8 @@ | ||
[![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) | ||
[![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) | ||
|
||
# Docker Nginx Static | ||
|
||
Docker Static Web Server | ||
|
||
Coming Soon... |
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,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
REGISTRY_HOST="ghcr.io" | ||
REGISTRY_USER="smashedr" | ||
REGISTRY_REPO="docker-nginx-static" | ||
|
||
if [ -f ".env" ];then | ||
echo "Sourcing Environment: .env" | ||
source ".env" | ||
fi | ||
|
||
if [ -z "${VERSION}" ];then | ||
if [ -z "${1}" ];then | ||
read -rp "Version: " VERSION | ||
else | ||
VERSION="${1}" | ||
fi | ||
fi | ||
#if [ -z "${USERNAME}" ];then | ||
# read -rp "Username: " USERNAME | ||
#fi | ||
#if [ -z "${PASSWORD}" ];then | ||
# read -rp "Password: " PASSWORD | ||
#fi | ||
|
||
echo "${REGISTRY_HOST}/${REGISTRY_USER}/${REGISTRY_REPO}:${VERSION}" | ||
|
||
#docker login --username "${USERNAME}" --password "${PASSWORD}" "${REGISTRY_HOST}" | ||
docker login "${REGISTRY_HOST}" | ||
|
||
docker buildx create --use | ||
docker buildx build --platform linux/amd64,linux/arm64 --push \ | ||
-t "${REGISTRY_HOST}/${REGISTRY_USER}/${REGISTRY_REPO}:${VERSION}" nginx | ||
|
||
#docker push "${REGISTRY_HOST}/${REGISTRY_USER}/${REGISTRY_REPO}:${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,48 @@ | ||
version: "3.8" | ||
|
||
services: | ||
nginx: | ||
build: | ||
context: nginx | ||
image: ghcr.io/smashedr/docker-nginx-static:latest | ||
#environment: | ||
# SUID: 1000 | ||
# STATIC: /static | ||
deploy: | ||
mode: global | ||
resources: | ||
limits: | ||
cpus: "1.0" | ||
memory: 25M | ||
volumes: | ||
- static:/static | ||
ports: | ||
- "8000:80" | ||
|
||
openssh-server: | ||
image: lscr.io/linuxserver/openssh-server:latest | ||
environment: | ||
- PUID=1000 | ||
- PGID=1000 | ||
- TZ=Etc/UTC | ||
- SUDO_ACCESS=false | ||
- PASSWORD_ACCESS=true | ||
- USER_NAME=${USER_NAME:-test} | ||
- USER_PASSWORD=${USER_PASSWORD:-test123} | ||
- DOCKER_MODS=linuxserver/mods:openssh-server-rsync | ||
- LOG_STDOUT=true | ||
deploy: | ||
mode: global | ||
resources: | ||
limits: | ||
cpus: "1.0" | ||
memory: 25M | ||
volumes: | ||
- config:/config | ||
- static:/static | ||
ports: | ||
- "${DOCKER_PORT:-2222}:2222" | ||
|
||
volumes: | ||
static: | ||
config: |
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,9 @@ | ||
FROM nginx:alpine-slim | ||
|
||
LABEL org.opencontainers.image.source="https://github.com/cssnr/docker-nginx-static" | ||
|
||
ENV TZ=UTC | ||
|
||
COPY nginx.conf /etc/nginx/nginx.conf | ||
|
||
COPY --chmod=0755 perms.sh /docker-entrypoint.d/ |
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,29 @@ | ||
user nginx; | ||
worker_processes auto; | ||
pid /var/run/nginx.pid; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
error_log /dev/stderr warn; | ||
|
||
http { | ||
sendfile on; | ||
charset utf-8; | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$time_local - $http_x_real_ip ($realip_remote_addr) ' | ||
'[$status] $body_bytes_sent $remote_user "$request" ' | ||
'"$http_referer" "$http_user_agent"'; | ||
access_log /dev/stdout main; | ||
|
||
server { | ||
listen 80; | ||
location / { | ||
root /static; | ||
autoindex on; | ||
} | ||
} | ||
} |
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,13 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
|
||
echo "Running: ${0}" | ||
|
||
echo "STATIC: ${STATIC:-/static}" | ||
echo "SUID: ${SUID:-1000}" | ||
|
||
echo "Setting Permissions ${SUID:-1000}:${SUID:-1000} on ${STATIC:-/static}" | ||
chown -R "${SUID:-1000}:${SUID:-1000}" "${STATIC:-/static}" | ||
|
||
echo "Done" |