Skip to content

Commit

Permalink
chore: Add Dockerfile and docker-compose.yml for containerization
Browse files Browse the repository at this point in the history
  • Loading branch information
Utesgui committed Jul 19, 2024
1 parent 458cea9 commit fc153f8
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: security.txt Image

on:
workflow_dispatch:
push:
branches:
- main

env:
IMAGE_BASE_TAG: git.b0t.at/b0t-at/security.txt

jobs:
build-and-push-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ vars.registry_uri }}
username: ${{ secrets.registry_username }}
password: ${{ secrets.registry_password }}
- name: Build and push Docker image Frontend
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ env.IMAGE_BASE_TAG }}:latest
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM nginx:alpine

# Copy the entrypoint script
COPY entrypoint.sh /entrypoint.sh

# Make the script executable
RUN chmod +x /entrypoint.sh

# Set the entrypoint script to run on container start
ENTRYPOINT ["/entrypoint.sh"]

# Start nginx in the foreground
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# security.txt
Takes an Email-Address (or any other string) and serves it via traefic under /security.txt
Takes an Email-Address (or any other string) and serves it under /security.txt (RFC 5785) as plain text.
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.8'
services:
web:
build: .
environment:
- SECURITY_STRING=This is a test security string.
ports:
- "80:80"
13 changes: 13 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# Check if the SECURITY_STRING environment variable is set and not empty
if [ -z "$SECURITY_STRING" ]; then
echo "The SECURITY_STRING environment variable is not set. Exiting..."
exit 1
fi

# Write the content of SECURITY_STRING to /usr/share/nginx/html/security.txt
echo "$SECURITY_STRING" > /usr/share/nginx/html/security.txt

# Execute the CMD from the Dockerfile, keeping nginx in the foreground
exec "$@"

0 comments on commit fc153f8

Please sign in to comment.