Skip to content

Commit

Permalink
Fix dockerfile (#208)
Browse files Browse the repository at this point in the history
* feat: docker file
  • Loading branch information
QizhengMo authored Nov 6, 2023
1 parent b832987 commit 924b8e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 28 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,7 @@ on:
workflow_dispatch:

jobs:

build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Build with Maven
run: mvn -B -ntp clean package -DskipTests=true -Pjar

docker:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM tomcat:9.0-jdk8-openjdk

ARG WAR_FILE=./target/arex-schedule-web-api.war
ADD $WAR_FILE /usr/local/tomcat/webapps/
FROM maven:3-openjdk-8-slim as builder
COPY . /usr/src/app/
WORKDIR /usr/src/app/arex-schedule-web-api
RUN mvn clean package -DskipTests

FROM tomcat:9.0-jdk8-openjdk
COPY --from=builder /usr/src/app/arex-schedule-web-api/target/arex-schedule-web-api.war /usr/local/tomcat/webapps/arex-schedule-web-api.war
WORKDIR /usr/local/tomcat/conf
RUN sed -i 'N;152a\\t<Context path="" docBase="arex-schedule-web-api.war" reloadable="true" />' server.xml

Expand Down

0 comments on commit 924b8e6

Please sign in to comment.