mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-11-15 10:45:36 +01:00
Add Dockerfile and automated image building (#213)
* Add Dockerfile * Add Docker build workflow * Make the image be tagged with commit sha and latest * Fix naming of builder layer * Switch to eclipse temurin for run image * Try using java 22 * nvm 21 it is * Install git in image * That wasn't the problem, copy .git now * Remove chown's cuz not needed * 17? * Add newline at the end of docker workflow * Only build container image on push to main
This commit is contained in:
parent
b232d7ccc0
commit
ca4014f130
42
.github/workflows/build-docker.yml
vendored
Normal file
42
.github/workflows/build-docker.yml
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
name: build-docker
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Log into registry ${{ env.REGISTRY }}
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=sha
|
||||
images: ${{ env.REGISTRY }}/${{ github.repository }}
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@ -0,0 +1,11 @@
|
||||
FROM --platform=$BUILDPLATFORM gradle:jdk17 as builder
|
||||
WORKDIR /build
|
||||
COPY build.gradle settings.gradle gradle.properties ./
|
||||
COPY .git .git
|
||||
COPY src src
|
||||
RUN gradle --no-daemon build
|
||||
|
||||
FROM --platform=$TARGETPLATFORM eclipse-temurin:21-jre-alpine
|
||||
WORKDIR /app
|
||||
COPY --from=builder /build/build/libs/ViaProxy-*.jar ViaProxy.jar
|
||||
ENTRYPOINT ["java", "-jar", "ViaProxy.jar"]
|
Loading…
Reference in New Issue
Block a user