Skip to content

Commit 4a8c768

Browse files
committed
container image
1 parent e89f5bc commit 4a8c768

4 files changed

Lines changed: 93 additions & 0 deletions

File tree

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!src/*
3+
!package*.json
4+
config
5+
!config/config.example.yaml

.github/workflows/docker_build.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build Docker image Steam-Watcher
2+
3+
on:
4+
schedule:
5+
- cron: "0 5 * * 1"
6+
push:
7+
branches: ["main"]
8+
pull_request:
9+
branches: ["main"]
10+
11+
concurrency:
12+
group: ${{ github.workflow }}
13+
14+
env:
15+
TITLE: GameTracking Monitor
16+
# github.repository as <account>/<repo>
17+
GHCR_SLUG: ghcr.io/lifeismana/steam-watcher
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
packages: write
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v6
28+
29+
- name: Docker meta
30+
id: meta
31+
uses: docker/metadata-action@v6
32+
with:
33+
images: |
34+
${{ env.GHCR_SLUG }}
35+
labels: |
36+
maintainer=${{ github.repository_owner }}
37+
org.opencontainers.image.vendor=${{ github.repository_owner }}
38+
org.opencontainers.image.title=${{ env.TITLE }}
39+
40+
- name: Setup Docker buildx
41+
uses: docker/setup-buildx-action@v4.0.0
42+
43+
# Login against a Docker registry except on PR
44+
# https://github.com/docker/login-action
45+
- name: Log into registry
46+
if: github.event_name != 'pull_request'
47+
uses: docker/login-action@v4.0.0
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.repository_owner }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
53+
# Build and push Docker image with Buildx (don't push on PR)
54+
# https://github.com/docker/build-push-action
55+
- name: Build and push Docker image
56+
id: build-and-push
57+
uses: docker/build-push-action@v7.0.0
58+
with:
59+
push: ${{ github.event_name != 'pull_request' }}
60+
tags: ${{ env.GHCR_SLUG }}:latest
61+
cache-from: ${{ env.GHCR_SLUG }}:latest
62+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM node:25-alpine3.23 AS builder
2+
WORKDIR /build-stage
3+
COPY package*.json ./
4+
RUN npm ci
5+
COPY src/* ./
6+
7+
FROM alpine:3.23
8+
WORKDIR /usr/src/app
9+
RUN apk add --no-cache libstdc++ dumb-init \
10+
&& addgroup -g 1000 node && adduser -u 1000 -G node -s /bin/sh -D node \
11+
&& chown node:node ./
12+
COPY --from=builder /usr/local/bin/node /usr/local/bin/
13+
COPY --from=builder /usr/local/bin/docker-entrypoint.sh /usr/local/bin/
14+
COPY config/config.example.yaml ./config/config.yaml
15+
ENTRYPOINT ["docker-entrypoint.sh"]
16+
VOLUME [ "/var/cache/gametracking-monitor" ]
17+
USER node
18+
COPY --from=builder /build-stage/ ./
19+
CMD ["dumb-init", "node", "bot.mjs"]

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
services:
2+
steam-watcher:
3+
build: .
4+
container_name: steam-watcher
5+
volumes:
6+
- ./config/:/usr/src/app/config/
7+
restart: always

0 commit comments

Comments
 (0)