summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yaml4
-rw-r--r--.github/workflows/deploy.yaml2
-rw-r--r--.github/workflows/publish-ghcr.yaml40
-rw-r--r--Dockerfile10
-rw-r--r--docker-compose.yml4
-rw-r--r--docs/running-gathio/installation.md28
-rw-r--r--gathio-docker/docker-compose.yml21
-rw-r--r--package.json6
-rw-r--r--pnpm-lock.yaml6
9 files changed, 103 insertions, 18 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 30ce676..a818c17 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v4
- name: Install pnpm
- uses: pnpm/action-setup@v2
+ uses: pnpm/action-setup@v4
with:
version: 9
@@ -44,7 +44,7 @@ jobs:
uses: actions/checkout@v4
- name: Install pnpm
- uses: pnpm/action-setup@v2
+ uses: pnpm/action-setup@v4
with:
version: 9
diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml
index fd2afea..4a34a2c 100644
--- a/.github/workflows/deploy.yaml
+++ b/.github/workflows/deploy.yaml
@@ -13,7 +13,7 @@ jobs:
uses: actions/checkout@v4
- name: Install pnpm
- uses: pnpm/action-setup@v2
+ uses: pnpm/action-setup@v4
with:
version: 9
diff --git a/.github/workflows/publish-ghcr.yaml b/.github/workflows/publish-ghcr.yaml
new file mode 100644
index 0000000..b30dc8e
--- /dev/null
+++ b/.github/workflows/publish-ghcr.yaml
@@ -0,0 +1,40 @@
+name: Publish to GHCR
+on:
+ workflow_dispatch:
+ push:
+ branches:
+ - main
+
+jobs:
+ publish:
+ permissions:
+ packages: write
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: get-npm-version
+ id: package-version
+ uses: martinbeentjes/npm-get-version-action@v1.3.1
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+ - name: Login to GHCR
+ uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Publish to GHCR
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./Dockerfile
+ push: true
+ platforms: linux/amd64,linux/arm/v7,linux/arm64
+ tags: |
+ ghcr.io/${{ github.repository }}:${{ github.sha }}
+ ghcr.io/${{ github.repository }}:${{ steps.package-version.outputs.current-version }}
+ ghcr.io/${{ github.repository }}:latest
diff --git a/Dockerfile b/Dockerfile
index 5da290e..61947a8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,6 @@
-FROM node:20-alpine
+# Docker builds hang in arm/v7 images, so we use Node 18 to build and Node 20 to run
+# Cf. https://github.com/docker/build-push-action/issues/1071
+FROM node:18-alpine AS BUILD_IMAGE
WORKDIR /app
RUN apk add --no-cache python3 build-base
ADD package.json pnpm-lock.yaml /app/
@@ -8,4 +10,10 @@ COPY . /app/
# Always exit 0 here because TSC will fail while we're migrating to TypeScript but
# not everything uses TypeScript
RUN pnpm run build; exit 0
+
+# Now we run the app
+FROM node:20-alpine
+ENV NODE_ENV=production
+WORKDIR /app
+COPY --from=BUILD_IMAGE /app ./
CMD ["node", "dist/start.js"]
diff --git a/docker-compose.yml b/docker-compose.yml
index a176800..5a8a0d9 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -3,7 +3,8 @@ volumes:
services:
gathio:
- build: .
+ container_name: gathio-app
+ image: ghcr.io/lowercasename/gathio:latest
links:
- mongo
ports:
@@ -14,6 +15,7 @@ services:
# The path to Gathio's user-uploaded event images folder - change to match your system
- ./gathio-docker/images:/app/public/events
mongo:
+ container_name: gathio-db
image: mongo:latest
volumes:
- mongodb_data_db:/data/db
diff --git a/docs/running-gathio/installation.md b/docs/running-gathio/installation.md
index 9b9191e..cdb3f44 100644
--- a/docs/running-gathio/installation.md
+++ b/docs/running-gathio/installation.md
@@ -91,7 +91,8 @@ the subject](https://www.linode.com/docs/web-servers/nginx/use-nginx-reverse-pro
## Docker
The easiest way to run Gathio using Docker is by using the provided
-`docker-compose` configuration.
+`docker-compose` configuration. We provide a Docker image at [GitHub
+Container Repository](https://github.com/lowercasename/gathio/pkgs/container/gathio).
Create a directory on your system where you'll keep the Gathio configuration
file and another where Gathio can store user-uploaded event images. Copy the
@@ -112,19 +113,32 @@ volumes:
```
Adjust any settings in the config file, especially the MongoDB URL, which should
-read as follows for the standard Dockerfile config, and the email service if you
+read as follows for the standard Docker Compose config, and the email service if you
want to enable it:
```ini
-mail_service = "nodemailer"
mongodb_url = "mongodb://mongo:27017/gathio"
+mail_service = "nodemailer"
+```
+
+You can copy the `docker-compose.yml` file into that same `gathio-docker` directory
+you created - you don't need any of the source code. Once you're done, your directory
+should look something like this:
+
+```
+gathio-docker
+├── config
+│ └── config.toml
+├── docker-compose.yml
+└── images
```
-Finally, start the Docker stack:
+Finally, from wherever you've put your `docker-compose.yml` file, start the Docker stack:
```bash
-docker-compose up -d --build
+cd gathio-docker
+docker-compose up -d
```
-Gathio should now be running on `http://localhost:3000`, and storing data in a
-Docker volume.
+Gathio should now be running on `http://localhost:3000`, storing data in a
+Docker volume, and storing images on your filesystem.
diff --git a/gathio-docker/docker-compose.yml b/gathio-docker/docker-compose.yml
new file mode 100644
index 0000000..5a8a0d9
--- /dev/null
+++ b/gathio-docker/docker-compose.yml
@@ -0,0 +1,21 @@
+volumes:
+ mongodb_data_db:
+
+services:
+ gathio:
+ container_name: gathio-app
+ image: ghcr.io/lowercasename/gathio:latest
+ links:
+ - mongo
+ ports:
+ - 3000:3000
+ volumes:
+ # The path to Gathio's config folder - change to match your system
+ - ./gathio-docker/config:/app/config
+ # The path to Gathio's user-uploaded event images folder - change to match your system
+ - ./gathio-docker/images:/app/public/events
+ mongo:
+ container_name: gathio-db
+ image: mongo:latest
+ volumes:
+ - mongodb_data_db:/data/db
diff --git a/package.json b/package.json
index a6e3035..628524f 100644
--- a/package.json
+++ b/package.json
@@ -47,6 +47,7 @@
"request": "^2.88.2",
"sanitize-html": "^2.13.0",
"toml": "^3.0.0",
+ "typescript": "^5.4.5",
"wait-on": "^7.2.0"
},
"devDependencies": {
@@ -60,7 +61,6 @@
"cypress": "^13.10.0",
"eslint": "^8.57.0",
"nodemon": "^2.0.22",
- "prettier": "^3.2.5",
- "typescript": "^5.4.5"
+ "prettier": "^3.2.5"
}
-}
+} \ No newline at end of file
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ee7f920..5139a4a 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -92,6 +92,9 @@ importers:
toml:
specifier: ^3.0.0
version: 3.0.0
+ typescript:
+ specifier: ^5.4.5
+ version: 5.4.5
wait-on:
specifier: ^7.2.0
version: 7.2.0
@@ -129,9 +132,6 @@ importers:
prettier:
specifier: ^3.2.5
version: 3.2.5
- typescript:
- specifier: ^5.4.5
- version: 5.4.5
packages: