-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added docker-build.yml which should build solarthing-server only
- Loading branch information
1 parent
dbfa67d
commit 24e3a83
Showing
10 changed files
with
129 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Create and publish a Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build-push: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
# https://github.com/marketplace/actions/checkout | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Install dependencies | ||
run: (cd web && npm install) | ||
- name: Build Boot Jar | ||
run: ./gradlew graphql:bootJar | ||
|
||
# https://github.com/marketplace/actions/docker-login | ||
- name: Log in to the Container registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
# https://github.com/marketplace/actions/docker-metadata-action | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
# images: ${{ env.REGISTRY }}/${{ github.actor }}/solarthing-server | ||
images: ${{ env.REGISTRY }}/wildmountainfarms/solarthing-server | ||
tags: | | ||
type=raw,value=edge,enable=${{ github.ref == 'refs/heads/master' }} | ||
# https://github.com/marketplace/actions/docker-setup-buildx | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
# https://github.com/marketplace/actions/build-and-push-docker-images | ||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
file: docker/solarthing-server/Dockerfile | ||
build-args: | ||
- 'BOOT_JAR=graphql/build/libs/graphql-0.0.1-SNAPSHOT.jar' | ||
push: true | ||
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Custom stuff: | ||
/test/ | ||
*.attach_pid* | ||
.~lock* | ||
*.log.gz | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# docker | ||
This directory is used to contain `Dockerfile`s to build `solarthing` and `solarthing-server` docker images. | ||
Note that this directory is designed to be separate from the state of a codebase at any given commit. | ||
Even while building docker images for older SolarThing versions, | ||
the latest files in this folder should be used to build those images. | ||
|
||
So, the only Dockerfiles that should be used to build solarthing should be on the master branch of this repository. | ||
|
||
```shell | ||
# run in solarthing root | ||
docker build -f docker/solarthing-server/Dockerfile --build-arg BOOT_JAR=graphql/build/libs/graphql-0.0.1-SNAPSHOT.jar --tag wildmountainfarms/solarthing-server:latest . | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM eclipse-temurin:19-jre-jammy as builder | ||
ARG BOOT_JAR | ||
COPY ${BOOT_JAR} application.jar | ||
RUN java -Djarmode=layertools -jar application.jar extract | ||
|
||
|
||
FROM eclipse-temurin:19-jre-jammy | ||
RUN ["mkdir", "/app"] | ||
WORKDIR "/app" | ||
COPY --from=builder dependencies/ ./ | ||
COPY --from=builder snapshot-dependencies/ ./ | ||
COPY --from=builder spring-boot-loader/ ./ | ||
COPY --from=builder application/ ./ | ||
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters