Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build and Push Docker Images

on:
workflow_dispatch:
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64, linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ github.ref_name }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion Companion/exporter/factory_building_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ var _ = Describe("FactoryBuildingCollector", func() {
Recipe: "Power Shard",
ManuSpeed: 100.0,
CircuitGroupId: 0,
Somersloops: 4,
Somersloops: 4,
PowerInfo: exporter.PowerInfo{
CircuitGroupId: 1,
PowerConsumed: 23,
Expand Down
10 changes: 5 additions & 5 deletions Companion/exporter/power_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ func powerMultiplier(clockspeed float64, sloops float64, slots float64) float64

func MaxParticleAcceleratorPower(recipe string) float64 {
recipes := map[string]float64{
"Dark Matter Crystal": 1500.0,
"Diamonds": 750.0,
"Ficsonium": 1500.0,
"Nuclear Pasta": 1500.0,
"Plutonium Pellet": 750.0,
"Dark Matter Crystal": 1500.0,
"Diamonds": 750.0,
"Ficsonium": 1500.0,
"Nuclear Pasta": 1500.0,
"Plutonium Pellet": 750.0,
"Alternate: Cloudy Diamonds": 750.0,
"Alternate: Dark Matter Crystallization": 1500.0,
"Alternate: Dark Matter Trap": 1500.0,
Expand Down
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM node:16-alpine AS map-builder
WORKDIR /build
COPY map/package*.json ./
RUN npm install
COPY map/ ./
RUN npm run compile

FROM golang:1.25.4-alpine AS go-builder
WORKDIR /build
COPY Companion/go.* ./
RUN go mod download
COPY Companion/ ./
ARG VERSION=dev
RUN CGO_ENABLED=0 go build -ldflags="-X 'main.Version=${VERSION}'" -o companion main.go

FROM alpine:latest
ARG PROMETHEUS_VERSION=2.27.1
ARG TARGETARCH
WORKDIR /app

RUN apk --no-cache add curl tar && \
curl -sL https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/prometheus-${PROMETHEUS_VERSION}.linux-${TARGETARCH}.tar.gz | tar xz && \
mv prometheus-${PROMETHEUS_VERSION}.linux-${TARGETARCH} prometheus && \
apk del curl tar

COPY --from=go-builder /build/companion /app/
COPY --from=map-builder /build/index.html /build/map-16k.png /build/vendor /build/img /build/js /app/map/
COPY Companion/prometheus.yml /app/prometheus/prometheus.yml

ENV FRM_LOG_STDOUT=true
EXPOSE 9000

CMD ["/app/companion"]
Loading