diff --git a/.dockerignore b/.dockerignore index f745fd27..a44657f3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,3 +10,4 @@ node_modules/ package.json yarn.lock .yarn +.env* diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index be3f7e45..303da539 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,7 +1,7 @@ # These are supported funding model platforms github: [mbround18] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: # Replace with a single Patreon username +patreon: [mbround18] # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 11d02fa3..ceeae440 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -2,6 +2,11 @@ name: Docker Build on: pull_request: + types: + - labeled + - edited + - synchronize + - unlabeled branches: - main @@ -9,6 +14,14 @@ env: CARGO_TERM_COLOR: always jobs: + cancel-previous: + name: Cancel Previous + runs-on: ubuntu-latest + steps: + - uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} + # Run tests. # See also https://docs.docker.com/docker-hub/builds/automated-testing/ build: @@ -18,25 +31,48 @@ jobs: max-parallel: 1 matrix: image: [odin, valheim] + include: + - image: odin + push: true + - image: valheim + push: ${{ contains(github.event.pull_request.labels.*.name, 'canary') }} steps: - uses: actions/checkout@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: mbround18 + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Docker meta + id: meta + uses: crazy-max/ghaction-docker-meta@v3 + with: + # list of Docker images to use as base name for tags + images: | + mbround18/${{ matrix.image }} + + # generate Docker tags based on the following events/attributes + tags: | + type=sha + - name: Build ${{ matrix.image }} id: docker_build uses: docker/build-push-action@v2 with: file: ./Dockerfile.${{ matrix.image }} - push: false - tags: mbround18/${{ matrix.image }}:latest - cache-from: type=gha - cache-to: type=gha,mode=max + push: ${{ matrix.push }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} build-args: | "GITHUB_SHA=${GITHUB_SHA}" "GITHUB_REF=${GITHUB_REF}" "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" + "ODIN_IMAGE_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}" - name: Finalization run: echo "Finalized" diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index a72c84c3..95791d71 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -60,8 +60,6 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max build-args: | "GITHUB_SHA=${GITHUB_SHA}" "GITHUB_REF=${GITHUB_REF}" diff --git a/.github/workflows/enforce-labels.yml b/.github/workflows/enforce-labels.yml index f698cf53..e730ce39 100644 --- a/.github/workflows/enforce-labels.yml +++ b/.github/workflows/enforce-labels.yml @@ -7,6 +7,9 @@ jobs: enforce-label: runs-on: ubuntu-latest steps: + - uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} - uses: yogevbd/enforce-label-action@2.2.2 with: REQUIRED_LABELS_ANY: "major,minor,patch,internal,performance,question,release,tests,wontfix,documentation,bug,dependencies" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b034577f..fe019e60 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,7 @@ jobs: steps: - uses: actions/checkout@v2 with: + token: "${{ secrets.GH_TOKEN }}" fetch-depth: 0 - uses: actions/setup-node@v2 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ab2e42b0..1deb115d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -11,14 +11,21 @@ env: CARGO_TERM_COLOR: always jobs: + cancel-previous: + name: Cancel Previous + runs-on: ubuntu-latest + steps: + - uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} build-nd-test: name: Build & Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose - - name: Lint - run: cargo fmt -- --check + - uses: actions/checkout@v2 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose + - name: Lint + run: cargo fmt -- --check diff --git a/Cargo.lock b/Cargo.lock index 1054bd4b..2a126088 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -465,7 +465,7 @@ checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi 0.10.0+wasi-snapshot-preview1", ] [[package]] @@ -476,9 +476,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "h2" -version = "0.3.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f3675cfef6a30c8031cf9e6493ebdc3bb3272a3fea3923c4210d1830e6a472" +checksum = "6c06815895acec637cd6ed6e9662c935b866d20a106f8361892893a7d9234964" dependencies = [ "bytes", "fnv", @@ -1367,9 +1367,9 @@ checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" [[package]] name = "smallvec" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" [[package]] name = "socket2" @@ -1395,9 +1395,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.77" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5239bc68e0fef57495900cfea4e8dc75596d9a319d7e16b1e0a440d24e6fe0a0" +checksum = "a4eac2e6c19f5c3abc0c229bea31ff0b9b091c7b14990e8924b92902a303a0c0" dependencies = [ "proc-macro2", "quote", @@ -1406,9 +1406,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.20.3" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d77883450d697c0010e60db3d940ed130b0ed81d27485edee981621b434e52" +checksum = "ffff4a02fa61eee51f95210fc9c98ea6eeb46bb071adeafd61e1a0b9b22c6a6d" dependencies = [ "cfg-if", "core-foundation-sys", @@ -1474,11 +1474,12 @@ dependencies = [ [[package]] name = "time" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", + "wasi 0.10.0+wasi-snapshot-preview1", "winapi", ] @@ -1519,9 +1520,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.3.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110" +checksum = "154794c8f499c2619acd19e839294703e9e32e7630ef5f46ea80d4ef0fbee5eb" dependencies = [ "proc-macro2", "quote", @@ -1597,9 +1598,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46125608c26121c81b0c6d693eab5a420e416da7e43c426d2e8f7df8da8a3acf" +checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" dependencies = [ "lazy_static", ] @@ -1779,9 +1780,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" diff --git a/Dockerfile.odin b/Dockerfile.odin index cfff4c2f..d0d036da 100644 --- a/Dockerfile.odin +++ b/Dockerfile.odin @@ -1,7 +1,7 @@ # ------------------ # # -- Odin Planner -- # # ------------------ # -FROM lukemathwalker/cargo-chef:latest-rust-1.54-alpine as planner +FROM lukemathwalker/cargo-chef:latest-rust-1.55-alpine as planner WORKDIR /data/odin COPY . . RUN cargo chef prepare --recipe-path recipe.json @@ -9,7 +9,7 @@ RUN cargo chef prepare --recipe-path recipe.json # ------------------ # # -- Odin Cacher -- # # ------------------ # -FROM lukemathwalker/cargo-chef:latest-rust-1.54-alpine as cacher +FROM lukemathwalker/cargo-chef:latest-rust-1.55-alpine as cacher WORKDIR /data/odin COPY --from=planner /data/odin/recipe.json recipe.json RUN cargo chef cook --release --recipe-path recipe.json @@ -35,9 +35,8 @@ RUN /usr/local/cargo/bin/cargo make -p production release # ------------------ # # -- Odin Runtime -- # # ------------------ # -FROM debian:buster-slim as runtime -WORKDIR /data/odin -COPY --from=builder /data/odin/target/release/odin /usr/local/bin/ -COPY --from=builder /data/odin/target/release/huginn /usr/local/bin/ -ENTRYPOINT ["/usr/local/bin/odin"] +FROM debian:11-slim as runtime +WORKDIR /apps +COPY --from=builder /data/odin/target/release/odin /data/odin/target/release/huginn ./ +ENTRYPOINT ["/apps/odin"] CMD ["--version"] diff --git a/Dockerfile.valheim b/Dockerfile.valheim index c71eecb3..8ba9831a 100644 --- a/Dockerfile.valheim +++ b/Dockerfile.valheim @@ -7,7 +7,7 @@ FROM mbround18/odin:${ODIN_IMAGE_VERSION} as runtime # --------------- # # -- Steam CMD -- # # --------------- # -FROM cm2network/steamcmd:root +FROM steamcmd/steamcmd:ubuntu RUN apt-get update \ && apt-get upgrade -y \ @@ -20,6 +20,15 @@ RUN apt-get update \ && gosu nobody true \ && dos2unix +RUN addgroup --system steam \ + && adduser --system \ + --home /home/steam \ + --shell /bin/bash \ + steam \ + && usermod -aG steam steam \ + && chmod ugo+rw /tmp/dumps + + # Container informaiton ARG GITHUB_SHA="not-set" ARG GITHUB_REF="not-set" @@ -60,13 +69,11 @@ ENV PUID=1000 \ COPY ./src/scripts/*.sh /home/steam/scripts/ COPY ./src/scripts/entrypoint.sh /entrypoint.sh -COPY --from=runtime /usr/local/bin/odin /usr/local/bin/odin -COPY --from=runtime /usr/local/bin/huginn /usr/local/bin/huginn +COPY --from=runtime /apps/odin /apps/huginn /usr/local/bin/ COPY ./src/scripts/steam_bashrc.sh /home/steam/.bashrc RUN usermod -u ${PUID} steam \ && groupmod -g ${PGID} steam \ - && chsh -s /bin/bash steam \ && printf "${GITHUB_SHA}\n${GITHUB_REF}\n${GITHUB_REPOSITORY}\n" >/home/steam/.version \ && chmod 755 -R /home/steam/scripts/ \ && chmod 755 /entrypoint.sh \ diff --git a/package.json b/package.json index b543fe53..c3773638 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,8 @@ "@auto-it/all-contributors": "10.32.0", "@auto-it/git-tag": "10.32.0", "@types/node": "15.3.0", - "auto": "10.32.0", - "typescript": "4.4.3" + "auto": "^10.32.1", + "typescript": "^4.4.3" }, "dependencies": { "@auto-it/core": "^10.27.0", diff --git a/src/scripts/entrypoint.sh b/src/scripts/entrypoint.sh index 387996e1..2951d275 100644 --- a/src/scripts/entrypoint.sh +++ b/src/scripts/entrypoint.sh @@ -119,8 +119,7 @@ setup_filesystem() { mkdir -p "${GAME_LOCATION}" mkdir -p "${GAME_LOCATION}/logs" chown -R ${STEAM_UID}:${STEAM_GID} "${GAME_LOCATION}" - cp /home/steam/steamcmd/linux64/steamclient.so /home/steam/valheim - + chown -R ${STEAM_UID}:${STEAM_GID} "${GAME_LOCATION}" # Other mkdir -p /home/steam/scripts diff --git a/yarn.lock b/yarn.lock index fb385b88..fc81c5b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -48,6 +48,13 @@ __metadata: languageName: node linkType: hard +"@auto-it/bot-list@npm:10.32.1": + version: 10.32.1 + resolution: "@auto-it/bot-list@npm:10.32.1" + checksum: b602ea296f587a3c42cb06b9f35cc6571531b3eff73abe4139eebbb99fec88b83419d21b2d727288e6d6b9495e92a35cabcf809ea9fad365c370e107497b785f + languageName: node + linkType: hard + "@auto-it/core@npm:10.32.0": version: 10.32.0 resolution: "@auto-it/core@npm:10.32.0" @@ -98,6 +105,56 @@ __metadata: languageName: node linkType: hard +"@auto-it/core@npm:10.32.1": + version: 10.32.1 + resolution: "@auto-it/core@npm:10.32.1" + dependencies: + "@auto-it/bot-list": 10.32.1 + "@endemolshinegroup/cosmiconfig-typescript-loader": ^3.0.2 + "@octokit/plugin-enterprise-compatibility": ^1.2.2 + "@octokit/plugin-retry": ^3.0.1 + "@octokit/plugin-throttling": ^3.2.0 + "@octokit/rest": ^18.0.0 + await-to-js: ^3.0.0 + chalk: ^4.0.0 + cosmiconfig: 7.0.0 + deepmerge: ^4.0.0 + dotenv: ^8.0.0 + endent: ^2.0.1 + enquirer: ^2.3.4 + env-ci: ^5.0.1 + fast-glob: ^3.1.1 + fp-ts: ^2.5.3 + fromentries: ^1.2.0 + gitlog: ^4.0.3 + https-proxy-agent: ^5.0.0 + import-cwd: ^3.0.0 + import-from: ^3.0.0 + io-ts: ^2.1.2 + lodash.chunk: ^4.2.0 + log-symbols: ^4.0.0 + node-fetch: 2.6.1 + parse-author: ^2.0.0 + parse-github-url: 1.0.2 + pretty-ms: ^7.0.0 + requireg: ^0.2.2 + semver: ^7.0.0 + signale: ^1.4.0 + tapable: ^2.2.0 + terminal-link: ^2.1.1 + tinycolor2: ^1.4.1 + ts-node: ^9.1.1 + tslib: 2.1.0 + type-fest: ^0.21.1 + typescript-memoize: ^1.0.0-alpha.3 + url-join: ^4.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 33d09cdc7eeefbd7f6df6f7aabcd5738414710e43c9b019c731b9dbc99b6ae3c42883a5c222975e9c31e264ead1a5412d3cfbcedaed7ac3cee2fa0fea984db86 + languageName: node + linkType: hard + "@auto-it/core@npm:^10.27.0": version: 10.29.2 resolution: "@auto-it/core@npm:10.29.2" @@ -159,12 +216,12 @@ __metadata: languageName: node linkType: hard -"@auto-it/npm@npm:10.32.0": - version: 10.32.0 - resolution: "@auto-it/npm@npm:10.32.0" +"@auto-it/npm@npm:10.32.1": + version: 10.32.1 + resolution: "@auto-it/npm@npm:10.32.1" dependencies: - "@auto-it/core": 10.32.0 - "@auto-it/package-json-utils": 10.32.0 + "@auto-it/core": 10.32.1 + "@auto-it/package-json-utils": 10.32.1 await-to-js: ^3.0.0 endent: ^2.0.1 env-ci: ^5.0.1 @@ -177,31 +234,31 @@ __metadata: typescript-memoize: ^1.0.0-alpha.3 url-join: ^4.0.0 user-home: ^2.0.0 - checksum: 5fa4ccecd461253553e78f734eaccfe2ba1d551916c57dd114ebad92b9a2b114abde4c04480d90ddc45097658666dbc97069643b73a8b301c27cceb8b4b55970 + checksum: 45ec5dbc384811a96112a5029fa091bba0139c0d5c00f19fc7e2e85cd0e41dd86506c4f7a4cc3d358f33bdca9022d45a649175bd91e61601508915e7e8385834 languageName: node linkType: hard -"@auto-it/package-json-utils@npm:10.32.0": - version: 10.32.0 - resolution: "@auto-it/package-json-utils@npm:10.32.0" +"@auto-it/package-json-utils@npm:10.32.1": + version: 10.32.1 + resolution: "@auto-it/package-json-utils@npm:10.32.1" dependencies: parse-author: ^2.0.0 parse-github-url: 1.0.2 - checksum: ccd15b2ba278e90ce227a7afc7749784345b36944b50aa03d11e16426c300ec38ce853b5eaaad0e6782e3dd7c80632762904c9b5bf59d731fceccac9f2b85a58 + checksum: cb4b5c2a4a4525bb408c3f1bd3688c4a0cddf8c4279159b56901f71bcd00fd00a14a2457e8f37af38b3e3c8795326c7679d2fce65c33d7e67fd308afd9e0c2e7 languageName: node linkType: hard -"@auto-it/released@npm:10.32.0": - version: 10.32.0 - resolution: "@auto-it/released@npm:10.32.0" +"@auto-it/released@npm:10.32.1": + version: 10.32.1 + resolution: "@auto-it/released@npm:10.32.1" dependencies: - "@auto-it/bot-list": 10.32.0 - "@auto-it/core": 10.32.0 + "@auto-it/bot-list": 10.32.1 + "@auto-it/core": 10.32.1 deepmerge: ^4.0.0 fp-ts: ^2.5.3 io-ts: ^2.1.2 tslib: 2.1.0 - checksum: 431c657f1fb3977054c1194274e931fa32d44cc49bd95f272668592c9b6f3fc1f2d50bfb600291ec84527319222276652306022e083f15b77a7fc222f908fdd2 + checksum: 7fa8f8fd56cfbb8ade2151d492e0842fdbeeee070c278211ef429a2d1510e6ecf560604eebc6e3c65aea84e56b9e6776ae0920711c36b3a9457fcfb5afdad77c languageName: node linkType: hard @@ -867,13 +924,13 @@ __metadata: languageName: node linkType: hard -"auto@npm:10.32.0": - version: 10.32.0 - resolution: "auto@npm:10.32.0" +"auto@npm:^10.32.1": + version: 10.32.1 + resolution: "auto@npm:10.32.1" dependencies: - "@auto-it/core": 10.32.0 - "@auto-it/npm": 10.32.0 - "@auto-it/released": 10.32.0 + "@auto-it/core": 10.32.1 + "@auto-it/npm": 10.32.1 + "@auto-it/released": 10.32.1 await-to-js: ^3.0.0 chalk: ^4.0.0 command-line-application: ^0.10.1 @@ -884,7 +941,7 @@ __metadata: tslib: 2.1.0 bin: auto: dist/bin/auto.js - checksum: 65d843ce3eb0ea81addec26858fe4d0972ad35648b9d107988c1e59bd23516f8f35f91c05f4aa31f01204b21e6ceff43f12ec526ac84239e680ea24ebf9862b6 + checksum: 2e7f316f15d0a3bad983eded63f88efdf045c3e4cdd294682522ef8d1e82597299e3a6c3179b6cc02416effbeef0105aa02aaa8a279c9e6a253b9706ae0bb721 languageName: node linkType: hard @@ -3169,7 +3226,7 @@ resolve@~1.7.1: languageName: node linkType: hard -typescript@4.4.3: +typescript@^4.4.3: version: 4.4.3 resolution: "typescript@npm:4.4.3" bin: @@ -3179,7 +3236,7 @@ typescript@4.4.3: languageName: node linkType: hard -"typescript@patch:typescript@4.4.3#~builtin": +"typescript@patch:typescript@^4.4.3#~builtin": version: 4.4.3 resolution: "typescript@patch:typescript@npm%3A4.4.3#~builtin::version=4.4.3&hash=d8b4e7" bin: @@ -3237,9 +3294,9 @@ typescript@4.4.3: "@types/node": 15.3.0 "@types/semver": ^7.3.5 "@yarnpkg/pnpify": ^3.0.0-rc.3 - auto: 10.32.0 + auto: ^10.32.1 semver: ^7.3.5 - typescript: 4.4.3 + typescript: ^4.4.3 languageName: unknown linkType: soft