Skip to content

Commit

Permalink
Test docker build & push.
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwenyihust committed Nov 24, 2023
1 parent 64de6b3 commit 14ec1a6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
27 changes: 26 additions & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,32 @@ jobs:
- uses: actions/checkout@v3

# Runs a set of commands using the runners shell
- name: Package
- name: Maven Package
run: |
cd examples/word-count
mvn clean package
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest

# - name: Docker Build
# run: |
# cd examples/word-count
# docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest .

# - name: Docker Push
# run: |
# cd examples/word-count
# docker tag word-count:latest ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest
# docker push ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest
25 changes: 0 additions & 25 deletions examples/word-count/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
<scala.version>2.12.18</scala.version>
<scala.compat.version>2.12</scala.compat.version>
<spark.version>3.5.0</spark.version>
<dockerfile.maven.plugin.version>1.4.13</dockerfile.maven.plugin.version>
<docker.image.prefix>wenyixu101</docker.image.prefix>
</properties>

<dependencies>
Expand Down Expand Up @@ -69,29 +67,6 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>${dockerfile.maven.plugin.version}</version>
<configuration>
<repository>${docker.image.prefix}/${project.artifactId}</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
<executions>
<execution>
<id>default</id>
<phase>deploy</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 14ec1a6

Please sign in to comment.