Merge pull request #108 from hugomd/feat/push-to-github-container-registry

Use GitHub Container Registry for Docker images
This commit is contained in:
Mike Cao 2020-09-07 02:05:51 -07:00 committed by GitHub
commit 45b991e1a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 14 deletions

View File

@ -1,6 +1,7 @@
on: on:
release: push:
types: [published] branches:
- feat/push-to-github-container-registry
jobs: jobs:
@ -13,17 +14,29 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Build PostgreSQL container image - name: Build PostgreSQL container image
run: docker build --build-arg DATABASE_TYPE=postgresql --tag docker.pkg.github.com/mikecao/umami/umami:postgresql-$(echo $GITHUB_SHA | head -c7) . run: |
docker build --build-arg DATABASE_TYPE=postgresql \
--tag ghcr.io/$GITHUB_ACTOR/umami:postgresql-$(echo $GITHUB_SHA | head -c7) \
--tag ghcr.io/$GITHUB_ACTOR/umami:postgresql-latest \
.
- name: Build MySQL container image - name: Build MySQL container image
run: docker build --build-arg DATABASE_TYPE=mysql --tag docker.pkg.github.com/mikecao/umami/umami:mysql-$(echo $GITHUB_SHA | head -c7) . run: |
docker build --build-arg DATABASE_TYPE=mysql \
--tag ghcr.io/$GITHUB_ACTOR/umami:mysql-$(echo $GITHUB_SHA | head -c7) \
--tag ghcr.io/$GITHUB_ACTOR/umami:mysql-latest \
.
- name: Docker login - name: Docker login
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CR_PAT: ${{ secrets.CR_PAT }}
run: docker login -u mikecao -p $GITHUB_TOKEN docker.pkg.github.com run: docker login -u $GITHUB_ACTOR -p $CR_PAT ghcr.io
- name: Push image to GitHub - name: Push image to GitHub
run: | run: |
docker push docker.pkg.github.com/mikecao/umami/umami:postgresql-$(echo $GITHUB_SHA | head -c7) # Push each image individually, avoiding pushing to umami:latest
docker push docker.pkg.github.com/mikecao/umami/umami:mysql-$(echo $GITHUB_SHA | head -c7) # as MySQL or PostgreSQL are required
docker push ghcr.io/$GITHUB_ACTOR/umami:postgresql-$(echo $GITHUB_SHA | head -c7)
docker push ghcr.io/$GITHUB_ACTOR/umami:postgresql-latest
docker push ghcr.io/$GITHUB_ACTOR/umami:mysql-$(echo $GITHUB_SHA | head -c7)
docker push ghcr.io/$GITHUB_ACTOR/umami:mysql-latest

View File

@ -60,13 +60,13 @@ The `HASH_SALT` is used to generate unique values for your installation.
### Build the application ### Build the application
``` ```bash
npm run build npm run build
``` ```
### Start the application ### Start the application
``` ```bash
npm start npm start
``` ```
@ -78,15 +78,26 @@ or change the [port](https://nextjs.org/docs/api-reference/cli#production) to se
To build the umami container and start up a Postgres database, run: To build the umami container and start up a Postgres database, run:
``` ```bash
docker-compose up docker-compose up
``` ```
Alternatively, to pull just the Umami Docker image with PostgreSQL support:
```bash
docker pull ghcr.io/mikecao/umami:postgresql-latest
```
Or with MySQL support:
```bash
docker pull ghcr.io/mikecao/umami:mysql-latest
```
## Getting updates ## Getting updates
To get the latest features, simply do a pull, install any new dependencies, and rebuild: To get the latest features, simply do a pull, install any new dependencies, and rebuild:
``` ```bash
git pull git pull
npm install npm install
npm run build npm run build
@ -94,4 +105,4 @@ npm run build
## License ## License
MIT MIT

View File

@ -2,7 +2,7 @@
version: '3' version: '3'
services: services:
umami: umami:
build: . image: ghcr.io/mikecao/umami:postgresql-latest
ports: ports:
- "3000:3000" - "3000:3000"
environment: environment: