Skip to content

Commit c517922

Browse files
committed
Agregar archivos de configuración y scripts para el servidor Docker KF2, incluyendo .gitattributes, .gitignore, Dockerfile, docker-compose, scripts de entrada y SSH, y un README completo.
0 parents  commit c517922

File tree

10 files changed

+858
-0
lines changed

10 files changed

+858
-0
lines changed

.gitattributes

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# =============================================================================
2+
# Docker KF2 Server - Git Attributes File
3+
# =============================================================================
4+
5+
# Auto detect text files and perform LF normalization
6+
* text=auto
7+
8+
# Explicitly declare text files you want to always be normalized and converted
9+
# to native line endings on checkout.
10+
*.md text
11+
*.txt text
12+
*.yml text
13+
*.yaml text
14+
*.json text
15+
*.js text
16+
*.ts text
17+
*.css text
18+
*.html text
19+
*.xml text
20+
*.conf text
21+
*.cfg text
22+
*.ini text
23+
*.toml text
24+
25+
# Shell scripts (Unix line endings)
26+
*.sh text eol=lf
27+
*.bash text eol=lf
28+
29+
# Dockerfile (Unix line endings)
30+
Dockerfile* text eol=lf
31+
*.dockerfile text eol=lf
32+
33+
# Docker Compose files (Unix line endings)
34+
docker-compose*.yml text eol=lf
35+
docker-compose*.yaml text eol=lf
36+
37+
# Configuration files
38+
.env* text
39+
.gitignore text
40+
.gitattributes text
41+
.editorconfig text
42+
43+
# Documentation
44+
README* text
45+
CHANGELOG* text
46+
LICENSE* text
47+
CONTRIBUTING* text
48+
49+
# Declare files that will always have CRLF line endings on checkout.
50+
*.bat text eol=crlf
51+
*.cmd text eol=crlf
52+
*.ps1 text eol=crlf
53+
54+
# Denote all files that are truly binary and should not be modified.
55+
*.png binary
56+
*.jpg binary
57+
*.jpeg binary
58+
*.gif binary
59+
*.ico binary
60+
*.mov binary
61+
*.mp4 binary
62+
*.mp3 binary
63+
*.flv binary
64+
*.fla binary
65+
*.swf binary
66+
*.gz binary
67+
*.zip binary
68+
*.7z binary
69+
*.ttf binary
70+
*.eot binary
71+
*.woff binary
72+
*.woff2 binary
73+
*.exe binary
74+
*.dll binary
75+
*.so binary
76+
*.dylib binary
77+
78+
# Archive files
79+
*.tar binary
80+
*.gz binary
81+
*.bz2 binary
82+
*.xz binary
83+
*.zip binary
84+
*.rar binary
85+
86+
# Docker related binaries
87+
*.tar.gz binary
88+
89+
# Linguist overrides for GitHub language detection
90+
# (helps GitHub properly identify the project language)
91+
*.md linguist-detectable=false
92+
*.yml linguist-detectable=false
93+
*.yaml linguist-detectable=false
94+
*.json linguist-detectable=false
95+
96+
# Mark generated files
97+
docs/api/* linguist-generated=true
98+
coverage/* linguist-generated=true
99+
100+
# Export ignore (files not included in git archive)
101+
.gitattributes export-ignore
102+
.gitignore export-ignore
103+
.github/ export-ignore
104+
.vscode/ export-ignore
105+
.idea/ export-ignore
106+
*.md export-ignore

.github/workflows/docker-build.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
release:
9+
types: [ published ]
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
jobs:
16+
build-and-push:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Log in to Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
tags: |
42+
# Generate tags for branches
43+
type=ref,event=branch
44+
# Generate tags for PRs
45+
type=ref,event=pr
46+
# Generate semver tags for releases
47+
type=semver,pattern={{version}}
48+
type=semver,pattern={{major}}.{{minor}}
49+
type=semver,pattern={{major}}
50+
# Generate 'latest' tag only for main branch
51+
type=raw,value=latest,enable={{is_default_branch}}
52+
# Generate 'develop' tag only for develop branch
53+
type=raw,value=develop,enable=${{ github.ref == 'refs/heads/develop' }}
54+
labels: |
55+
org.opencontainers.image.title=KF2 LinuxGSM Server
56+
org.opencontainers.image.description=Killing Floor 2 dedicated server using LinuxGSM with SSH support
57+
org.opencontainers.image.vendor=lechuga16
58+
59+
- name: Build and push Docker image
60+
uses: docker/build-push-action@v5
61+
with:
62+
context: .
63+
file: ./Dockerfile
64+
push: ${{ github.event_name != 'pull_request' }}
65+
tags: ${{ steps.meta.outputs.tags }}
66+
labels: ${{ steps.meta.outputs.labels }}
67+
cache-from: type=gha
68+
cache-to: type=gha,mode=max
69+
platforms: linux/amd64
70+
71+
- name: Generate summary
72+
run: |
73+
echo "## Docker Build Summary" >> $GITHUB_STEP_SUMMARY
74+
echo "- **Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
75+
echo "- **Event:** ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
76+
echo "- **Registry:** ${{ env.REGISTRY }}" >> $GITHUB_STEP_SUMMARY
77+
echo "- **Image:** ${{ env.IMAGE_NAME }}" >> $GITHUB_STEP_SUMMARY
78+
echo "- **Tags:** ${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY

.gitignore

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# =============================================================================
2+
# Docker KF2 Server - Git Ignore File
3+
# =============================================================================
4+
5+
# Environment files with sensitive data
6+
.env
7+
.env.local
8+
.env.production
9+
.env.staging
10+
11+
# Docker volumes and data
12+
volumes/
13+
data/
14+
logs/
15+
16+
# Docker build cache
17+
.docker/
18+
19+
# IDE and Editor files
20+
.vscode/
21+
.idea/
22+
*.swp
23+
*.swo
24+
*~
25+
26+
# System files
27+
.DS_Store
28+
.DS_Store?
29+
._*
30+
.Spotlight-V100
31+
.Trashes
32+
ehthumbs.db
33+
Thumbs.db
34+
desktop.ini
35+
36+
# Temporary files
37+
*.tmp
38+
*.temp
39+
*.log
40+
*.pid
41+
*.seed
42+
*.pid.lock
43+
44+
# Runtime data
45+
pids/
46+
*.pid
47+
*.seed
48+
*.pid.lock
49+
50+
# Coverage directory used by tools like istanbul
51+
coverage/
52+
*.lcov
53+
54+
# nyc test coverage
55+
.nyc_output
56+
57+
# Grunt intermediate storage
58+
.grunt
59+
60+
# Bower dependency directory
61+
bower_components
62+
63+
# node_modules (if any Node.js tools are used)
64+
node_modules/
65+
npm-debug.log*
66+
yarn-debug.log*
67+
yarn-error.log*
68+
69+
# Optional npm cache directory
70+
.npm
71+
72+
# Optional REPL history
73+
.node_repl_history
74+
75+
# Output of 'npm pack'
76+
*.tgz
77+
78+
# Yarn Integrity file
79+
.yarn-integrity
80+
81+
# dotenv environment variables file (already covered above but being explicit)
82+
.env
83+
84+
# next.js build output
85+
.next
86+
87+
# Nuxt.js build / generate output
88+
.nuxt
89+
dist
90+
91+
# Gatsby files
92+
.cache/
93+
public
94+
95+
# Storybook build outputs
96+
.out
97+
.storybook-out
98+
99+
# Temporary folders
100+
tmp/
101+
temp/
102+
103+
# Backup files
104+
*.bak
105+
*.backup
106+
*.old
107+
108+
# OS generated files
109+
.directory
110+
111+
# KDE directory preferences
112+
.directory
113+
114+
# Linux trash folder which might appear on any partition or disk
115+
.Trash-*
116+
117+
# .nfs files are created when an open file is removed but is still being accessed
118+
.nfs*
119+
120+
# Windows thumbnail cache files
121+
Thumbs.db
122+
Thumbs.db:encryptable
123+
ehthumbs.db
124+
ehthumbs_vista.db
125+
126+
# Dump file
127+
*.stackdump
128+
129+
# Folder config file
130+
[Dd]esktop.ini
131+
132+
# Recycle Bin used on file shares
133+
$RECYCLE.BIN/
134+
135+
# Windows Installer files
136+
*.cab
137+
*.msi
138+
*.msix
139+
*.msm
140+
*.msp
141+
142+
# Windows shortcuts
143+
*.lnk

Dockerfile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# LinuxGSM Killing Floor 2 Dockerfile with SSH Support
3+
#
4+
# https://github.com/lechuga16/Docker-KF2
5+
#
6+
7+
FROM ghcr.io/gameservermanagers/linuxgsm:ubuntu-24.04
8+
9+
LABEL org.opencontainers.image.title="KF2 LinuxGSM Server"
10+
LABEL org.opencontainers.image.description="Killing Floor 2 dedicated server using LinuxGSM with SSH support"
11+
LABEL org.opencontainers.image.url="https://github.com/lechuga16/Docker-KF2"
12+
LABEL org.opencontainers.image.source="https://github.com/lechuga16/Docker-KF2"
13+
LABEL org.opencontainers.image.vendor="lechuga16"
14+
LABEL org.opencontainers.image.licenses="MIT"
15+
LABEL maintainer="lechuga16"
16+
LABEL version="1.0.0"
17+
18+
ARG SHORTNAME=kf2
19+
ENV GAMESERVER=kf2server
20+
21+
WORKDIR /app
22+
23+
## Auto install game server requirements and SSH server
24+
RUN depshortname=$(curl --connect-timeout 10 -s https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/ubuntu-24.04.csv |awk -v shortname="kf2" -F, '$1==shortname {$1=""; print $0}') \
25+
&& echo "**** Update package list ****" \
26+
&& apt-get update \
27+
&& if [ -n "${depshortname}" ]; then \
28+
echo "**** Install ${depshortname} ****" \
29+
&& apt-get install -y ${depshortname}; \
30+
fi \
31+
&& echo "**** Install SSH server ****" \
32+
&& apt-get install -y openssh-server \
33+
&& echo "**** Cleanup ****" \
34+
&& apt-get -y autoremove \
35+
&& apt-get clean \
36+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
37+
38+
HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /app/entrypoint-healthcheck.sh || exit 1
39+
40+
RUN date > /build-time.txt
41+
42+
COPY docker-scripts/ /app/docker-scripts/
43+
COPY entrypoint.sh /app/entrypoint.sh
44+
45+
ENTRYPOINT ["/bin/bash", "./entrypoint.sh"]

0 commit comments

Comments
 (0)