Skip to content

Commit 6dc6921

Browse files
authored
Merge pull request beevelop#27 from beevelop/update
Update image
2 parents 02bd627 + 9ff29e3 commit 6dc6921

File tree

5 files changed

+82
-35
lines changed

5 files changed

+82
-35
lines changed

.github/workflows/docker.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Docker Image
2+
3+
on:
4+
schedule:
5+
- cron: "0 10 * * *" # everyday at 10am
6+
push:
7+
branches: ["**"]
8+
tags: ["v*.*.*"]
9+
10+
env:
11+
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
12+
13+
jobs:
14+
main:
15+
runs-on: ubuntu-20.04
16+
timeout-minutes: 20
17+
steps:
18+
- name: Check out the repo
19+
uses: actions/checkout@v2
20+
- name: Set imageName based on the repository name
21+
id: step_one
22+
run: |
23+
imageName="${GITHUB_REPOSITORY/docker-/}"
24+
echo $imageName
25+
echo "imageName=$imageName" >> $GITHUB_ENV
26+
- name: Docker meta
27+
id: docker_meta
28+
uses: crazy-max/ghaction-docker-meta@v1
29+
with:
30+
images: ${{ env.imageName }}
31+
- name: Set up QEMU
32+
uses: docker/setup-qemu-action@v1
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v1
35+
- name: Login to Harbor
36+
uses: docker/login-action@v1
37+
with:
38+
username: ${{ secrets.DOCKERHUB_USERNAME }}
39+
password: ${{ secrets.DOCKERHUB_TOKEN }}
40+
- name: Buildx cache
41+
uses: actions/cache@v1
42+
with:
43+
path: ${{ github.workspace }}/cache
44+
key: ${{ runner.os }}-docker-${{ hashfiles('cache/**') }}
45+
restore-keys: |
46+
${{ runner.os }}-docker
47+
- name: Build and push
48+
id: docker_build
49+
uses: docker/build-push-action@v2
50+
with:
51+
platforms: ${{ env.platforms }}
52+
push: ${{ github.event_name != 'pull_request' }}
53+
tags: ${{ steps.docker_meta.outputs.tags }}
54+
labels: ${{ steps.docker_meta.outputs.labels }}
55+
cache-from: type=local,src=${{ github.workspace }}/cache
56+
cache-to: type=local,dest=${{ github.workspace }}/cache
57+
- name: Run Trivy vulnerability scanner
58+
uses: aquasecurity/trivy-action@master
59+
with:
60+
image-ref: ${{ env.imageName }}:${{ steps.docker_meta.outputs.version }}
61+
format: "template"
62+
template: "@/contrib/sarif.tpl"
63+
output: "trivy-results.sarif"
64+
- name: Upload Trivy scan results to GitHub Security tab
65+
uses: github/codeql-action/upload-sarif@v1
66+
with:
67+
sarif_file: "trivy-results.sarif"

.travis.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

Dockerfile

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,5 @@
11
FROM nginx:alpine
22

3-
ARG BUILD_DATE
4-
ARG BUILD_VERSION
5-
ARG VCS_REF
6-
7-
LABEL maintainer="Maik Hummel <[email protected]>" \
8-
org.label-schema.build-date=$BUILD_DATE \
9-
org.label-schema.version=$BUILD_VERSION \
10-
org.label-schema.vcs-ref=$VCS_REF \
11-
org.label-schema.schema-version="1.0" \
12-
org.label-schema.vcs-url="https://github.com/beevelop/docker-nginx-basic-auth.git" \
13-
org.label-schema.name="beevelop/nginx-basic-auth" \
14-
org.label-schema.vendor="Maik Hummel (beevelop)" \
15-
org.label-schema.description="Simple Docker image for basic authentication" \
16-
org.label-schema.url="https://beevelop.com/" \
17-
org.label-schema.license="MIT" \
18-
org.opencontainers.image.title="beevelop/nginx-basic-auth" \
19-
org.opencontainers.image.description="Simple Docker image for basic authentication" \
20-
org.opencontainers.image.licenses="MIT" \
21-
org.opencontainers.image.authors="Maik Hummel (beevelop)" \
22-
org.opencontainers.image.vendor="Maik Hummel (beevelop)" \
23-
org.opencontainers.image.url="https://github.com/beevelop/docker-nginx-basic-auth" \
24-
org.opencontainers.image.documentation="https://github.com/beevelop/docker-nginx-basic-auth/blob/master/README.md" \
25-
org.opencontainers.image.source="https://github.com/beevelop/docker-nginx-basic-auth.git"
26-
273
ENV HTPASSWD='foo:$apr1$odHl5EJN$KbxMfo86Qdve2FH4owePn.' \
284
FORWARD_PORT=80 \
295
FORWARD_HOST=web

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016-2020 Maik Hummel (beevelop)
3+
Copyright (c) 2016-2021 Maik Hummel (beevelop)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
[![Travis](https://shields.beevelop.com/travis/beevelop/docker-nginx-basic-auth.svg?style=flat-square)](https://travis-ci.org/beevelop/docker-nginx-basic-auth)
21
[![Pulls](https://shields.beevelop.com/docker/pulls/beevelop/nginx-basic-auth.svg?style=flat-square)](https://links.beevelop.com/d-nginx-basic-auth)
32
[![Size](https://shields.beevelop.com/docker/image/size/beevelop/nginx-basic-auth/latest.svg?style=flat-square)](https://links.beevelop.com/d-nginx-basic-auth)
43
[![Layers](https://shields.beevelop.com/docker/image/layers/beevelop/nginx-basic-auth/latest.svg?style=flat-square)](https://links.beevelop.com/d-nginx-basic-auth)
54
![Badges](https://shields.beevelop.com/badge/badges-6-brightgreen.svg?style=flat-square)
65
[![Beevelop](https://links.beevelop.com/honey-badge)](https://beevelop.com)
76

87
# nginx-basic-auth
9-
----
8+
9+
---
10+
1011
> Simple Docker image to provide basic authentication for a single other container.
1112
1213
## Quickstart
14+
1315
```bash
1416
docker run -d --name web dockercloud/hello-world
1517
docker run -d -p 80:80 --link web:web --name auth beevelop/nginx-basic-auth
@@ -18,6 +20,7 @@ docker run -d -p 80:80 --link web:web --name auth beevelop/nginx-basic-auth
1820
Try accessing and logging in with username `foo` and password `bar`.
1921

2022
## Advanced
23+
2124
```bash
2225
docker run -d \
2326
-e HTPASSWD='foo:$apr1$odHl5EJN$KbxMfo86Qdve2FH4owePn.' \
@@ -26,28 +29,36 @@ docker run -d \
2629
--name auth \
2730
beevelop/nginx-basic-auth
2831
```
32+
2933
> Use single quotes to prevent unwanted interpretation of `$` signs!
3034
3135
## Configuration
36+
3237
- `HTPASSWD` (default: `foo:$apr1$odHl5EJN$KbxMfo86Qdve2FH4owePn.`): Will be written to the .htpasswd file on launch (non-persistent)
3338
- `FORWARD_PORT` (default: `80`): Port of the **source** container that should be forwarded
3439
- `FORWARD_HOST` (default: `web`): Hostname of the **source** container that should be forwarded
35-
> The container does not need any volumes to be mounted! Nonetheless you will find all interesting files at `/etc/nginx/*`.
40+
> The container does not need any volumes to be mounted! Nonetheless you will find all interesting files at `/etc/nginx/*`.
3641
3742
## Multiple Users
43+
3844
Multiple Users are possible by separating the users by newline. To pass the newlines properly you need to use Shell Quoting (like `$'foo\nbar'`):
45+
3946
```
4047
docker run -d --link web:web --name auth \
4148
-e HTPASSWD=$'foo:$apr1$odHl5EJN$KbxMfo86Qdve2FH4owePn.\ntest:$apr1$LKkW8P4Y$P1X/r2YyaexhVL1LzZAQm.' \
4249
beevelop/nginx-basic-auth
4350
```
51+
4452
results in 2 users (`foo:bar` and `test:test`).
4553

4654
## Troubleshooting
55+
4756
```
4857
nginx: [emerg] host not found in upstream "web" in /etc/nginx/conf.d/auth.conf:80
4958
```
59+
5060
- You need to link the container as `web` (`--link foobar:web`)
5161

5262
---
63+
5364
- SSL is unsupported ATM, but might be available in the near future. For now it might be a suitable solution to use another reverse proxy (e.g. `jwilder/nginx-proxy`) that acts as a central gateway. You just need to configure the `VIRTUAL_HOST` env and disable port forwarding.

0 commit comments

Comments
 (0)