Skip to content

Commit

Permalink
Merge branch 'main' into try-implement-way-to-modify-id-generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ughuuu committed Nov 28, 2023
2 parents 8705f6a + 97188b9 commit 93fd01a
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.github
test/
.editorconfig
.env.example
.eslintrc.js
.jsdoc.js
node_modules/
35 changes: 35 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Docker Publish

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# From https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
jobs:
docker-publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- name: Build and push ( if on main ) Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:18-alpine
# From https://github.com/pnpm/pnpm/issues/4837

EXPOSE 8890/tcp
EXPOSE 8891/udp

COPY . noray

WORKDIR noray

RUN npm i -g npm@latest; \
# Install pnpm
npm install -g pnpm; \
pnpm --version; \
pnpm setup; \
mkdir -p /usr/local/share/pnpm &&\
export PNPM_HOME="/usr/local/share/pnpm" &&\
export PATH="$PNPM_HOME:$PATH"; \
pnpm bin -g &&\
# Install dependencies
pnpm install

CMD pnpm start:prod
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ To run *noray*, use `pnpm start` or `pnpm start:prod` for production use.
Upon startup, the application will allocate all the configured ports and start
listening for incoming connections. Logs are written to `stdout`.

### Usage with Docker

Create `.env` file from `.env.example`.

Build and run docker:

```
docker build . -t noray
docker run -p 8090:8090 -p 8091:8091 --env-file=.env -t noray
```

Or run prebuilt docker:
```
docker run -p 8090:8090 -p 8091:8091 --env-file=.env -t ghcr.io/foxssake/noray:main
```

#### EADDRNOTAVAIL

If you get an `EADDRNOTAVAIL` error when trying to listen on an IPv6 address,
you either need to [enable IPv6 in Docker], or choose an IPv4 host address to
listen on, e.g. '0.0.0.0' or 'localhost'.

[enable IPv6 in Docker]: https://docs.docker.com/config/daemon/ipv6/

## Documentation

### Protocol
Expand Down

0 comments on commit 93fd01a

Please sign in to comment.