feat(gateway): add Dockerfile and GH Actions build script
This commit is contained in:
parent
a5af6793f8
commit
5d24e86a7e
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
# Include project code and build files
|
# Include project code and build files
|
||||||
!PluralKit.*/
|
!PluralKit.*/
|
||||||
|
!gateway/
|
||||||
!Myriad/
|
!Myriad/
|
||||||
!PluralKit.sln
|
!PluralKit.sln
|
||||||
!nuget.config
|
!nuget.config
|
||||||
@ -13,3 +14,4 @@
|
|||||||
# Re-exclude host build artifact directories
|
# Re-exclude host build artifact directories
|
||||||
**/bin
|
**/bin
|
||||||
**/obj
|
**/obj
|
||||||
|
**/target
|
35
.github/workflows/gateway.yml
vendored
Normal file
35
.github/workflows/gateway.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
name: Build gateway Docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- 'gateway/'
|
||||||
|
- 'proto/'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
if: github.repository == 'xSke/PluralKit'
|
||||||
|
steps:
|
||||||
|
- uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.CR_PAT }}
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||||
|
- uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
# https://github.com/docker/build-push-action/issues/378
|
||||||
|
context: .
|
||||||
|
file: Dockerfile.gateway
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
ghcr.io/pluralkit/gateway:${{ env.BRANCH_NAME }}
|
||||||
|
ghcr.io/pluralkit/gateway:${{ github.sha }}
|
||||||
|
ghcr.io/pluralkit/gateway:latest
|
||||||
|
cache-from: type=registry,ref=ghcr.io/pluralkit/gateway:${{ env.BRANCH_NAME }}
|
||||||
|
cache-to: type=inline
|
19
Dockerfile.gateway
Normal file
19
Dockerfile.gateway
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# twilight requires newer rustc than what is in alpine:latest
|
||||||
|
FROM alpine:edge AS builder
|
||||||
|
|
||||||
|
RUN apk add cargo
|
||||||
|
|
||||||
|
# Precache crates.io index
|
||||||
|
RUN cargo search >/dev/null
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
COPY proto/ /build/proto
|
||||||
|
COPY gateway/ /build/gateway
|
||||||
|
|
||||||
|
RUN (cd gateway && cargo build --release)
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
COPY --from=builder /build/gateway/target/release/pluralkit /opt/gateway
|
||||||
|
|
||||||
|
ENTRYPOINT ["/opt/gateway"]
|
Loading…
Reference in New Issue
Block a user