Skip to content
Open
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
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
packages
work
dist
*.tsbuildinfo
12 changes: 4 additions & 8 deletions .github/workflows/build-base-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build baseimages
uses: docker/build-push-action@v6
Expand All @@ -40,19 +40,15 @@ jobs:
tags: |
ghcr.io/signalk/signalk-server-base:${{ matrix.arch }}-${{ matrix.os }}

- name: Modify Dockerfile_rel for testing
run: |
sed -i \
"s|cr.signalk.io/signalk/signalk-server-base:latest|ghcr.io/signalk/signalk-server-base:${{ matrix.arch }}-${{ matrix.os }}|g" \
./docker/Dockerfile_rel

- name: Build Signal K test docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile_rel
platforms: ${{ matrix.platform }}
build-args: |
REGISTRY=ghcr.io
FROM_TAG=${{ matrix.arch }}-${{ matrix.os }}
TAG=latest

create-and-push-manifest:
Expand All @@ -68,7 +64,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Docker Hub
uses: docker/login-action@v3
Expand Down
48 changes: 10 additions & 38 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,10 @@ on:
- '*'
- '!v*'
workflow_dispatch:
pull_request:

jobs:
signalk-server_npm_files:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Node setup
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Build npm files locally and upload artifacts
run: |
npm cache clean -f
npm install npm@latest -g
npm install --package-lock-only
npm ci && npm cache clean --force
npm run build:all
npm pack --workspaces
rm typedoc-signalk-theme*.tgz # This is only needed as a dev dependency
npm pack
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: packed-modules
path: |
*.tgz

docker_images:
needs: signalk-server_npm_files
strategy:
matrix:
os: [22.04, 24.04]
Expand All @@ -62,18 +35,15 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- uses: actions/download-artifact@v4
with:
name: packed-modules
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile
platforms: ${{ matrix.platform }}
push: true
tags: ghcr.io/signalk/signalk-server:${{ matrix.arch }}-${{ matrix.os }}-${{ github.run_id }}
tags: ghcr.io/${{ github.repository }}:${{ matrix.arch }}-${{ matrix.os }}-${{ github.run_id }}
build-args: |
REGISTRY=ghcr.io
UBUNTU_VERSION=${{ matrix.os }}
Expand All @@ -96,14 +66,16 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
signalk/signalk-server
ghcr.io/signalk/signalk-server
${{ github.repository }}
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=sha
flavor: |
suffix=${{ matrix.suffix }}
- name: Login to Docker Hub
# Don't attempt to push to DockerHub from forks
if: ${{ github.repository_owner == 'signalk' }}
uses: docker/login-action@v3
with:
username: signalkci
Expand All @@ -112,8 +84,8 @@ jobs:
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push multi-arch manifest to GHCR and Docker Hub
uses: int128/docker-manifest-create-action@v2
with:
Expand All @@ -135,4 +107,4 @@ jobs:
packages: signalk-server
delete-untagged: true
delete-tags: amd-22.04-${{ github.run_id }},arm-22.04-${{ github.run_id }},amd-24.04-${{ github.run_id }},arm-24.04-${{ github.run_id }}
token: ${{ secrets.GHCR_PAT }}
token: ${{ secrets.GITHUB_TOKEN }}
7 changes: 2 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,6 @@ jobs:
- name: Set TAG for build-args
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Modify Dockerfile_rel for build
run: |
sed -i \
"s|cr.signalk.io/signalk/signalk-server-base:latest|ghcr.io/signalk/signalk-server-base:latest-${{ matrix.os }}|g" \
./docker/Dockerfile_rel
- name: Build and push
uses: docker/build-push-action@v6
with:
Expand All @@ -190,6 +185,8 @@ jobs:
push: true
tags: ghcr.io/signalk/signalk-server:${{ matrix.arch }}-${{ matrix.os }}-${{ github.run_id }}
build-args: |
REGISTRY=ghcr.io
FROM_TAG=latest-${{ matrix.os }}
TAG=${{ steps.vars.outputs.tag }}

create-and-push-manifest:
Expand Down
11 changes: 10 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,18 @@ RUN npm config rm proxy \

FROM base AS tarballs_installed
WORKDIR /home/node/signalk
COPY *.tgz .
USER root
# Install the latest npm version
RUN npm install -g npm@latest

# Copy the source code
COPY . .

RUN npm install
RUN npm run build:all
RUN npm pack --workspaces
RUN npm pack
RUN rm typedoc-signalk-theme*.tgz # This is only needed as a dev dependency
RUN npm i -g *.tgz
# move server-admin-ui that gets installed as sibling of signalk-server
RUN mv /usr/lib/node_modules/@signalk/* /usr/lib/node_modules/signalk-server/node_modules/@signalk/
Expand Down
7 changes: 5 additions & 2 deletions docker/Dockerfile_rel
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM cr.signalk.io/signalk/signalk-server-base:latest
ARG REGISTRY="cr.signalk.io"
ARG FROM_TAG="latest"

FROM ${REGISTRY}/signalk/signalk-server-base:${FROM_TAG}

RUN npm config rm proxy \
&& npm config rm https-proxy \
Expand All @@ -8,7 +11,7 @@ RUN npm config rm proxy \
&& npm cache clean -f

ARG TAG

RUN npm i -g signalk-server@$TAG \
&& ln -s /usr/lib/node_modules/signalk-server /home/node/signalk

Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Supported os/architectures:
You can start a local server on port 3000 with demo data with

```
docker run --init -it --rm --name signalk-server --publish 3000:3000 --entrypoint /home/node/signalk/bin/signalk-server cr.signalk.io/signalk/signalk-server --sample-nmea0183-data
docker run --init -it --rm --publish 3000:3000 cr.signalk.io/signalk/signalk-server --sample-nmea0183-data
```

For real use you need to persist /home/node/.signalk where the server's configuration is stored, with for example
Expand Down
Loading