-
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.
chore: Add Dockerfile and docker-compose.yml for containerization
- Loading branch information
Showing
5 changed files
with
65 additions
and
1 deletion.
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,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 |
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 @@ | ||
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;"] |
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 |
---|---|---|
@@ -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. |
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 @@ | ||
version: '3.8' | ||
services: | ||
web: | ||
build: . | ||
environment: | ||
- SECURITY_STRING=This is a test security string. | ||
ports: | ||
- "80:80" |
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 @@ | ||
#!/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 "$@" |