mirror of
https://gitlab.bmcstudios.org/public_projects/swg-server-docker.git
synced 2026-01-16 17:04:26 -05:00
Fixes to allow private swg repositories
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.env
|
||||||
25
Dockerfile
25
Dockerfile
@@ -22,7 +22,9 @@ RUN apt-get install -y \
|
|||||||
openjdk-11-jdk:i386 \
|
openjdk-11-jdk:i386 \
|
||||||
psmisc \
|
psmisc \
|
||||||
supervisor \
|
supervisor \
|
||||||
wget
|
wget \
|
||||||
|
vim \
|
||||||
|
nano
|
||||||
|
|
||||||
RUN apt-get clean && \
|
RUN apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
@@ -44,7 +46,26 @@ ENV ORACLE_HOME=/usr/lib/oracle/18.3/client
|
|||||||
ENV LD_LIBRARY_PATH=/usr/lib/oracle/18.3/client/lib:/usr/include/oracle/18.3/client
|
ENV LD_LIBRARY_PATH=/usr/lib/oracle/18.3/client/lib:/usr/include/oracle/18.3/client
|
||||||
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-i386
|
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-i386
|
||||||
|
|
||||||
RUN git clone https://github.com/SWG-Source/swg-main.git /swg-main
|
# Declare build arguments with a default for the repo URL
|
||||||
|
ARG REPO_URL=https://github.com/SWG-Source/swg-main.git
|
||||||
|
ARG REPO_USERNAME
|
||||||
|
ARG REPO_PASSWORD
|
||||||
|
|
||||||
|
# Clone the repository, using credentials if provided
|
||||||
|
RUN if [ -n "$REPO_USERNAME" ] && [ -n "$REPO_PASSWORD" ]; then \
|
||||||
|
# URL-encode the password to handle special characters
|
||||||
|
ENCODED_PASSWORD=$(echo "$REPO_PASSWORD" | sed -e 's/%/%25/g' -e 's/@/%40/g' -e 's/:/%3A/g' -e 's/\$/%24/g' -e 's/&/%26/g' -e 's/+/%2B/g' -e 's/,/%2C/g' -e 's|/|%2F|g' -e 's/;/%3B/g' -e 's/=/%3D/g' -e 's/?/%3F/g' -e 's/ /%20/g'); \
|
||||||
|
# Extract the hostname (e.g., gitlab.bmcstudios.org) from the repo URL
|
||||||
|
REPO_HOST=$(echo "$REPO_URL" | sed -e 's|https://||' -e 's|/.*||'); \
|
||||||
|
# Globally configure git to rewrite URLs for this host to include credentials.
|
||||||
|
# This ensures ALL git operations for this host are authenticated.
|
||||||
|
git config --global url."https://${REPO_USERNAME}:${ENCODED_PASSWORD}@${REPO_HOST}".insteadOf "https://${REPO_HOST}"; \
|
||||||
|
# Now clone the repository and its submodules. The rewrite rule will be applied automatically.
|
||||||
|
git clone --recurse-submodules "${REPO_URL}" /swg-main; \
|
||||||
|
else \
|
||||||
|
git clone --recurse-submodules "${REPO_URL}" /swg-main; \
|
||||||
|
fi
|
||||||
|
|
||||||
WORKDIR /swg-main
|
WORKDIR /swg-main
|
||||||
RUN ant git_update_submods
|
RUN ant git_update_submods
|
||||||
|
|
||||||
|
|||||||
40
README.md
40
README.md
@@ -1,8 +1,36 @@
|
|||||||
# swg-docker
|
# swg-docker
|
||||||
|
|
||||||
Instructions:
|
This project sets up a development environment for SWG using Docker.
|
||||||
- Clone this repository
|
|
||||||
- `docker compose up -d`
|
## Instructions:
|
||||||
- `docker exec -it swg bash` to log into a shell in the swg container
|
|
||||||
- `ant swg` to compile the game and the assets
|
1. Clone this repository.
|
||||||
- `ant start` to run the server
|
2. **(Optional)** To use a custom git repository for the server source, create a file named `.env` in this directory. See the "Custom Repository" section below for details.
|
||||||
|
3. Run `docker compose up -d --build` to build the images and start the services.
|
||||||
|
4. Run `docker exec -it swg bash` to log into a shell in the `swg` container.
|
||||||
|
5. Run `ant swg` to compile the game and the assets.
|
||||||
|
6. Run `ant start` to run the server.
|
||||||
|
|
||||||
|
## Custom Repository
|
||||||
|
|
||||||
|
You can configure the Docker build to pull the `swg-main` source from your own repository. Create a file named `.env` in the root of this project and add the following variables as needed.
|
||||||
|
|
||||||
|
**Example `.env` file:**
|
||||||
|
|
||||||
|
```.env
|
||||||
|
# .env file for custom repository configuration
|
||||||
|
|
||||||
|
# The full HTTPS URL to your git repository.
|
||||||
|
# If left unset, it defaults to https://github.com/SWG-Source/swg-main.git
|
||||||
|
REPO_URL=https://github.com/SWG-Source/swg-main.git
|
||||||
|
|
||||||
|
# (Optional) Credentials for private repositories.
|
||||||
|
# For security, it is highly recommended to use a Personal Access Token instead of your actual password.
|
||||||
|
REPO_USERNAME=your-gitlab-username
|
||||||
|
REPO_PASSWORD=your-personal-access-token
|
||||||
|
|
||||||
|
# (Optional) Credentials for overriding the default oracle DB
|
||||||
|
ORACLE_PASSWORD=YourSecureOraclePassword
|
||||||
|
APP_USER=YourAppUser
|
||||||
|
APP_USER_PASSWORD=YourSecureAppPassword
|
||||||
|
```
|
||||||
@@ -7,9 +7,9 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "1521:1521"
|
- "1521:1521"
|
||||||
environment:
|
environment:
|
||||||
ORACLE_PASSWORD: swg
|
ORACLE_PASSWORD: ${ORACLE_PASSWORD:-swg}
|
||||||
APP_USER: swg
|
APP_USER: ${APP_USER:-swg}
|
||||||
APP_USER_PASSWORD: swg
|
APP_USER_PASSWORD: ${APP_USER_PASSWORD:-swg}
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "healthcheck.sh"]
|
test: ["CMD", "healthcheck.sh"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
@@ -28,6 +28,10 @@ services:
|
|||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
|
args:
|
||||||
|
- REPO_URL=${REPO_URL}
|
||||||
|
- REPO_USERNAME=${REPO_USERNAME}
|
||||||
|
- REPO_PASSWORD=${REPO_PASSWORD}
|
||||||
ports:
|
ports:
|
||||||
- "44451-44453:44451-44453/tcp"
|
- "44451-44453:44451-44453/tcp"
|
||||||
- "44462-44464:44462-44464/tcp"
|
- "44462-44464:44462-44464/tcp"
|
||||||
@@ -36,9 +40,9 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
DB_HOST: oracle
|
DB_HOST: oracle
|
||||||
DB_PORT: 1521
|
DB_PORT: 1521
|
||||||
DB_USER: swg
|
DB_USER: ${APP_USER:-swg}
|
||||||
ORACLE_PASSWORD: swg
|
ORACLE_PASSWORD: ${ORACLE_PASSWORD:-swg}
|
||||||
DB_PASSWORD: swg
|
DB_PASSWORD: ${APP_USER_PASSWORD:-swg}
|
||||||
tty: true
|
tty: true
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
Reference in New Issue
Block a user