Push docker image to ghcr
This commit is contained in:
parent
8b2e4b6609
commit
6e6076242d
3 changed files with 21 additions and 11 deletions
17
.github/workflows/push.yml
vendored
17
.github/workflows/push.yml
vendored
|
@ -5,10 +5,10 @@ jobs:
|
|||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
node-version: [16.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.4.0
|
||||
- uses: actions/checkout@v3.0.0
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
|
@ -88,7 +88,7 @@ jobs:
|
|||
runs-on: ubuntu-20.04
|
||||
if: github.event_name == 'push' && (startsWith(github.event.ref, 'refs/tags/') || startsWith(github.event.ref, 'refs/heads/v0.') || github.event.ref == 'refs/heads/master' || github.event.ref == 'refs/heads/test')
|
||||
steps:
|
||||
- uses: actions/checkout@v2.4.0
|
||||
- uses: actions/checkout@v3.0.0
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2.1.7
|
||||
|
@ -119,11 +119,18 @@ jobs:
|
|||
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v1.10.0
|
||||
uses: docker/login-action@v1.14.1
|
||||
with:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v1.10.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
|
@ -132,7 +139,7 @@ jobs:
|
|||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||
tags: ${{ steps.docker_meta.outputs.tags }},ghcr.io/${{ steps.docker_meta.outputs.tags }}
|
||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha
|
||||
|
|
10
Dockerfile
10
Dockerfile
|
@ -1,11 +1,11 @@
|
|||
FROM --platform=$BUILDPLATFORM node:alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY yarn.lock package.json .
|
||||
RUN yarn config set network-timeout 300000 && yarn
|
||||
|
||||
COPY . .
|
||||
# Using yarn to install dependencies in CI will cause network timeout
|
||||
# Refer to https://github.com/date-fns/date-fns/issues/1004
|
||||
RUN yarn config set network-timeout 300000 \
|
||||
&& yarn \
|
||||
&& yarn build \
|
||||
RUN yarn build \
|
||||
# remove source maps - people like small image
|
||||
&& rm public/*.map || true
|
||||
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
|
||||
The site [http://yacd.haishan.me](http://yacd.haishan.me) is served with HTTP not HTTPS is because many browsers block requests to HTTP resources from a HTTPS website. If you think it's not safe, you could just download the [zip of the gh-pages](https://github.com/haishanh/yacd/archive/gh-pages.zip), unzip and open or serve `index.html` directly.
|
||||
|
||||
[Docker image](https://hub.docker.com/r/haishanh/yacd) is also available as `haishanh/yacd`.
|
||||
Docker image
|
||||
|
||||
- Docker Hub [`haishanh/yacd`](https://hub.docker.com/r/haishanh/yacd)
|
||||
- GitHub Container Registry [`ghcr.io/haishanh/yacd`](https://github.com/haishanh/yacd/pkgs/container/yacd)
|
||||
|
||||
## Development
|
||||
|
||||
|
|
Loading…
Reference in a new issue