-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve our docker config (#1373)
* greatly simplify docker * back to gcc since I can't the libs to load properly * fix typo add set -e to entrypoint better copy of entrypoint.sh and use proper entrypoint * use debian instead of gcc for runtime comment and organize it a bit drop gcc to 12 since we are using debian 12 as well * explicitly include mariadb libs * Make the server not crash in the case we are using only env-vars make the dockerfile have configs in the expected location incase of bypassing entrypoint.sh * remove unneede var from example, since it's in the container now * coments to dockerfile * Revert master server changes * Resolve conflicting port options between chat, master, and world move chat_server_port to shared since it's used by world and chat * Don't error if file does not exists when updating a config option move update before and use bin dir var
- Loading branch information
1 parent
a84ca1f
commit 9116317
Showing
38 changed files
with
204 additions
and
360 deletions.
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
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,56 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
tags: | ||
- "v*.*.*" | ||
pull_request: | ||
branches: | ||
- "main" | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
# generate Docker tags based on the following events/attributes | ||
tags: | | ||
type=ref,event=pr | ||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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
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
This file was deleted.
Oops, something went wrong.
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,51 @@ | ||
FROM gcc:12 as build | ||
|
||
WORKDIR /app | ||
|
||
RUN set -ex; \ | ||
apt-get update; \ | ||
apt-get install -y cmake | ||
|
||
COPY . /app/ | ||
COPY --chmod=0500 ./build.sh /app/ | ||
|
||
RUN sed -i 's/MARIADB_CONNECTOR_COMPILE_JOBS__=.*/MARIADB_CONNECTOR_COMPILE_JOBS__=2/' /app/CMakeVariables.txt | ||
|
||
RUN ./build.sh | ||
|
||
FROM debian:12 as runtime | ||
|
||
WORKDIR /app | ||
|
||
RUN --mount=type=cache,id=build-apt-cache,target=/var/cache/apt \ | ||
apt update && \ | ||
apt install -y libssl3 libcurl4 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Grab libraries and load them | ||
COPY --from=build /app/build/mariadbcpp/src/mariadb_connector_cpp-build/libmariadbcpp.so /usr/local/lib/ | ||
COPY --from=build /app/build/mariadbcpp/src/mariadb_connector_cpp-build/libmariadb/libmariadb/libmariadb.so.3 /usr/local/lib | ||
RUN ldconfig | ||
|
||
# Server bins | ||
COPY --from=build /app/build/*Server /app/ | ||
|
||
# Necessary suplimentary files | ||
COPY --from=build /app/build/*.ini /app/configs/ | ||
COPY --from=build /app/build/vanity/*.* /app/vanity/* | ||
COPY --from=build /app/build/navmeshes /app/navmeshes | ||
COPY --from=build /app/build/migrations /app/migrations | ||
COPY --from=build /app/build/*.dcf /app/ | ||
|
||
# backup of config and vanity files to copy to the host incase | ||
# of a mount clobbering the copy from above | ||
COPY --from=build /app/build/*.ini /app/default-configs/ | ||
COPY --from=build /app/build/vanity/*.* /app/default-vanity/* | ||
|
||
# needed as the container runs with the root user | ||
# and therefore sudo doesn't exist | ||
ENV USE_SUDO_AUTH=0 | ||
ENV DLU_CONFIG_DIR=/app/configs/ | ||
|
||
COPY --chmod=0500 ./entrypoint.sh /app/ | ||
ENTRYPOINT [ "/app/entrypoint.sh" ] |
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
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
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
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
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
Oops, something went wrong.