Skip to content

Commit

Permalink
Merge pull request #8 from claabs/main
Browse files Browse the repository at this point in the history
Build and distribute Docker image
  • Loading branch information
garrettjoecox authored Sep 22, 2024
2 parents d566f82 + 7e8903c commit 1388195
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build-and-push-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Docker Build

on:
push:
branches:
- main

jobs:
docker-build:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}
15 changes: 13 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
FROM denoland/deno:latest
FROM denoland/deno:alpine

# The port that your application listens to.
EXPOSE 43385

VOLUME [ "/logs" ]

WORKDIR /app

# Symlink stats.json into a volume, as it's hard to mount from the workdir
RUN mkdir /logs && ln -s /logs/stats.json ./stats.json && chown -R deno:deno /logs

# Prefer not to run as root.
USER deno

CMD ["run", "--allow-all", "https://raw.githubusercontent.com/garrettjoecox/anchor/main/mod.ts"]
# Copy in source code
COPY *.ts .

# Compile the main app so that it doesn't need to be compiled each startup/entry.
RUN deno cache mod.ts

CMD ["run", "--allow-net", "--allow-env", "--allow-write", "mod.ts"]
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ deno run --allow-all mod.ts
+"gRemoteGIIP": "127.0.0.1",
```

### Docker

```sh
docker run -p 43385:43385 -v /my/mnt/logs:/logs ghcr.io/garrettjoecox/anchor:latest
```

Optional environment variables can be set:

- `PORT`: configures the server port inside the container; defaults to `43385`
- `QUIET`: when set, fewer log messages are output; defaults to unset

## Packet protocol

> This is for anyone wanting to extend the client side of anchor while still
Expand Down

0 comments on commit 1388195

Please sign in to comment.