Skip to content

Commit

Permalink
Enable build and deploy (#6)
Browse files Browse the repository at this point in the history
* Add build files

* Change branch name to main

* Update .github/workflows/build-image-dev.yml

Co-authored-by: Derek Ellis <[email protected]>

* Update Dockerfile

Co-authored-by: Derek Ellis <[email protected]>

Co-authored-by: Derek Ellis <[email protected]>
  • Loading branch information
ryanlyrl and dellisd authored May 31, 2021
1 parent e074394 commit 2291dc8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build-image-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build watershed development image

on:
push:
branches: [ main ]

jobs:
build-server-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Authenticate package registry
run: echo "${{ secrets.CONTAINER_TOKEN }}" | docker login https://ghcr.io -u ${GITHUB_ACTOR} --password-stdin

- name: Get tag
run: echo "BUILD_TAG=$(git describe --tags)" >> $GITHUB_ENV

- name: Build and tag image
run: docker build -t ghcr.io/cuhacking/watershed:${BUILD_TAG} -t ghcr.io/cuhacking/watershed:dev .

- name: Push image
if: success()
run: docker push --all-tags ghcr.io/cuhacking/watershed
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM gradle:jdk15 AS builder

COPY . /home/gradle/src
WORKDIR /home/gradle/src

RUN gradle :server:shadowJar

FROM openjdk:15

COPY --from=builder /home/gradle/src/server/build/libs /usr/src/app
WORKDIR /usr/src/app
EXPOSE 8080
CMD ["java", "-jar", "server-all.jar"]

LABEL org.opencontainers.image.source https://github.com/cuhacking/watershed
1 change: 1 addition & 0 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
kotlin("plugin.serialization") version "1.4.32"
id("com.squareup.sqldelight") version "1.4.3"
id("org.flywaydb.flyway") version "7.8.2"
id("com.github.johnrengelman.shadow") version "7.0.0"
application
}

Expand Down

0 comments on commit 2291dc8

Please sign in to comment.