diff --git a/.github/workflows/docker-multitest.yml b/.github/workflows/docker-multitest.yml new file mode 100644 index 0000000..e69135b --- /dev/null +++ b/.github/workflows/docker-multitest.yml @@ -0,0 +1,63 @@ +name: Check Multi Arch + +on: + push: + branches-ignore: + - master + pull_request: + branches: + - master + + +jobs: + Normal: + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v2 + + - name: Setup ENV + run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2.1.4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx + + - name: Normal + uses: docker/build-push-action@v2 + with: + platforms: linux/amd64,linux/arm64 + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + push: false + file: Dockerfile + tags: | + emcniece/dockeryourxyzzy:${{ env.VERSION }} + ghcr.io/emcniece/dockeryourxyzzy:${{ env.VERSION }} + emcniece/dockeryourxyzzy:latest + ghcr.io/emcniece/dockeryourxyzzy:latest + + - name: Prebuilt + uses: docker/build-push-action@v2 + with: + platforms: linux/amd64,linux/arm64 + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + push: false + file: Dockerfile.built + tags: | + emcniece/dockeryourxyzzy:${{ env.VERSION }}-built + ghcr.io/emcniece/dockeryourxyzzy:${{ env.VERSION }}-built + + - name: Check default.sh + run: shellcheck scripts/default.sh \ No newline at end of file diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index aaf1a81..db23033 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -6,21 +6,75 @@ on: jobs: build: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Get release version - id: get_version - run: echo "RELEASE_VERSION=$(cat ./VERSION)" >> $GITHUB_ENV - - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@master - with: - name: emcniece/dockeryourxyzzy - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - tags: "latest,${{ env.RELEASE_VERSION }}" - - name: Docker Hub Description - uses: peter-evans/dockerhub-description@v2 - env: - DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - DOCKERHUB_REPOSITORY: emcniece/dockeryourxyzzy + # steps: + # - uses: actions/checkout@master + # - name: Get release version + # id: get_version + # run: echo "RELEASE_VERSION=$(cat ./VERSION)" >> $GITHUB_ENV + # - name: Publish to Registry + # uses: elgohr/Publish-Docker-Github-Action@master + # with: + # name: emcniece/dockeryourxyzzy + # username: ${{ secrets.DOCKER_USERNAME }} + # password: ${{ secrets.DOCKER_PASSWORD }} + # tags: "latest,${{ env.RELEASE_VERSION }}" + # - name: Docker Hub Description + # uses: peter-evans/dockerhub-description@v2 + # env: + # DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }} + # DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + # DOCKERHUB_REPOSITORY: emcniece/dockeryourxyzzy + + Normal: + runs-on: ubuntu-latest + steps: + # - name: Login To GitHub + # run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin + + - name: Login to Docker + run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin + + - uses: actions/checkout@v2 + + - name: Setup ENV + run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2.1.4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx + + - name: Normal + uses: docker/build-push-action@v2 + with: + platforms: linux/amd64,linux/arm64 + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + push: true + file: Dockerfile + tags: | + emcniece/dockeryourxyzzy:${{ env.VERSION }} +# ghcr.io/emcniece/dockeryourxyzzy:${{ env.VERSION }} + emcniece/dockeryourxyzzy:latest +# ghcr.io/emcniece/dockeryourxyzzy:latest + + - name: Prebuilt + uses: docker/build-push-action@v2 + with: + platforms: linux/amd64,linux/arm64 + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + push: true + file: Dockerfile.built + tags: | + emcniece/dockeryourxyzzy:${{ env.VERSION }}-built +# ghcr.io/emcniece/dockeryourxyzzy:${{ env.VERSION }}-built diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index 559dacc..18abdd8 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -8,7 +8,7 @@ on: - master jobs: - build: + Normal: runs-on: ubuntu-latest steps: - uses: actions/checkout@master @@ -16,7 +16,19 @@ jobs: run: shellcheck scripts/default.sh - name: Build Image - run: make image + run: make image - name: Inspect - run: make inspect \ No newline at end of file + run: make inspect + + Prebuilt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - name: Build Image + run: make built-image + + - name: Inspect + run: make built-inspect + diff --git a/Dockerfile.built b/Dockerfile.built new file mode 100644 index 0000000..613f2cf --- /dev/null +++ b/Dockerfile.built @@ -0,0 +1,36 @@ +FROM davidcaste/alpine-tomcat:jdk8tomcat7 as builder + +# MAVEN +ENV MAVEN_VERSION 3.5.4 +ENV USER_HOME_DIR /root +ENV SHA ce50b1c91364cb77efe3776f756a6d92b76d9038b0a0782f7d53acf1e997a14d +ENV BASE_URL https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries +ENV MAVEN_HOME /usr/share/maven +ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2" + +RUN apk add --no-cache curl tar procps \ + && mkdir -p /usr/share/maven/ref \ + && curl -fsSL -o /tmp/apache-maven.tar.gz "${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz" \ + && echo "${SHA} /tmp/apache-maven.tar.gz" | sha256sum -c - || true \ + && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \ + && rm -f /tmp/apache-maven.tar.gz \ + && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn + +# PYX +ENV GIT_BRANCH master + +RUN apk add git --no-cache \ + && git clone -b $GIT_BRANCH https://github.com/ajanata/PretendYoureXyzzy.git /project + +ADD overrides/settings-docker.xml /usr/share/maven/ref/ +WORKDIR /project + +RUN mv build.properties.example build.properties \ + && mvn compile war:war -Dhttps.protocols=TLSv1.2 -Dmaven.buildNumber.doCheck=false -Dmaven.buildNumber.doUpdate=false + + +FROM jetty:9-jre11-slim + +COPY --from=builder /project/target/ZY.war /var/lib/jetty/webapps/ROOT.war + +CMD [ "java","-jar","/usr/local/jetty/start.jar" ] \ No newline at end of file diff --git a/Makefile b/Makefile index 510f353..c9e73f7 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,15 @@ image: docker build -t $(DOCKER_IMAGE):$(VERSION) \ -f Dockerfile . +inspect: + docker inspect $(DOCKER_IMAGE):$(VERSION) + +built-image: + docker build -t $(DOCKER_IMAGE):$(VERSION)-built -f Dockerfile.built . + +built-inspect: + docker inspect $(DOCKER_IMAGE):$(VERSION)-built + run: docker run -d -p 8080:8080 $(DOCKER_IMAGE):$(VERSION)