Skip to content

Commit

Permalink
Switch to a more maintained image (#460)
Browse files Browse the repository at this point in the history
* Switch to a more maintained image

* removed caching

* sha

* images

* matrix

* dumps
  • Loading branch information
mbround18 authored Oct 5, 2021
1 parent 2932c50 commit 6f1628a
Show file tree
Hide file tree
Showing 13 changed files with 182 additions and 73 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ node_modules/
package.json
yarn.lock
.yarn
.env*
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
44 changes: 40 additions & 4 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,26 @@ name: Docker Build

on:
pull_request:
types:
- labeled
- edited
- synchronize
- unlabeled
branches:
- main

env:
CARGO_TERM_COLOR: always

jobs:
cancel-previous:
name: Cancel Previous
runs-on: ubuntu-latest
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
build:
Expand All @@ -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"
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/enforce-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ jobs:
enforce-label:
runs-on: ubuntu-latest
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: yogevbd/[email protected]
with:
REQUIRED_LABELS_ANY: "major,minor,patch,internal,performance,question,release,tests,wontfix,documentation,bug,dependencies"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
token: "${{ secrets.GH_TOKEN }}"
fetch-depth: 0

- uses: actions/setup-node@v2
Expand Down
21 changes: 14 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,21 @@ env:
CARGO_TERM_COLOR: always

jobs:
cancel-previous:
name: Cancel Previous
runs-on: ubuntu-latest
steps:
- uses: styfle/[email protected]
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
35 changes: 18 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions Dockerfile.odin
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# ------------------ #
# -- 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

# ------------------ #
# -- 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
Expand All @@ -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"]
15 changes: 11 additions & 4 deletions Dockerfile.valheim
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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"
Expand Down Expand Up @@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions src/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 6f1628a

Please sign in to comment.