-
Notifications
You must be signed in to change notification settings - Fork 1.2k
add docker file #1220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ChaosYao
wants to merge
3
commits into
sofastack:master
Choose a base branch
from
ChaosYao:2025-09-05_dockerFile
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
add docker file #1220
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,62 @@ | ||
| # Include any files or directories that you don't want to be copied to your | ||
| # container here (e.g., local build artifacts, temporary files, etc.). | ||
| # | ||
| # For more help, visit the .dockerignore file reference guide at | ||
| # https://docs.docker.com/go/build-context-dockerignore/ | ||
|
|
||
| **/.DS_Store | ||
| **/.classpath | ||
| **/.dockerignore | ||
| **/.env | ||
| **/.factorypath | ||
| **/.git | ||
| **/.gitignore | ||
| **/.idea | ||
| **/.project | ||
| **/.sts4-cache | ||
| **/.settings | ||
| **/.toolstarget | ||
| **/.vs | ||
| **/.vscode | ||
| **/.next | ||
| **/.cache | ||
| **/*.dbmdl | ||
| **/*.jfm | ||
| **/charts | ||
| **/docker-compose* | ||
| **/compose.y*ml | ||
| **/Dockerfile* | ||
| **/secrets.dev.yaml | ||
| **/values.dev.yaml | ||
| **/vendor | ||
| LICENSE | ||
| README.md | ||
| **/*.class | ||
| **/*.iml | ||
| **/*.ipr | ||
| **/*.iws | ||
| **/*.log | ||
| **/.apt_generated | ||
| **/.gradle | ||
| **/.gradletasknamecache | ||
| **/.nb-gradle | ||
| **/.springBeans | ||
| **/build | ||
| **/dist | ||
| **/gradle-app.setting | ||
| **/nbbuild | ||
| **/nbdist | ||
| **/nbproject/private | ||
| **/target | ||
| *.ctxt | ||
| .mtj.tmp | ||
| .mvn/timing.properties | ||
| buildNumber.properties | ||
| dependency-reduced-pom.xml | ||
| hs_err_pid* | ||
| pom.xml.next | ||
| pom.xml.releaseBackup | ||
| pom.xml.tag | ||
| pom.xml.versionsBackup | ||
| release.properties | ||
| replay_pid* |
This file contains hidden or 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,77 @@ | ||
| # syntax=docker/dockerfile:1 | ||
|
|
||
| # Comments are provided throughout this file to help you get started. | ||
| # If you need more help, visit the Dockerfile reference guide at | ||
| # https://docs.docker.com/go/dockerfile-reference/ | ||
|
|
||
| # Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7 | ||
|
|
||
| ################################################################################ | ||
|
|
||
| # Create a stage for resolving and downloading dependencies. | ||
| FROM eclipse-temurin:8-jdk-jammy as deps | ||
|
|
||
| WORKDIR /build | ||
|
|
||
| # Copy the mvnw wrapper with executable permissions. | ||
| COPY --chmod=0755 mvnw mvnw | ||
| COPY .mvn/ .mvn/ | ||
|
|
||
| # Download dependencies as a separate step to take advantage of Docker's caching. | ||
| # Leverage a cache mount to /root/.m2 so that subsequent builds don't have to | ||
| # re-download packages. | ||
| RUN --mount=type=bind,source=pom.xml,target=pom.xml \ | ||
| --mount=type=cache,target=/root/.m2 ./mvnw dependency:go-offline -DskipTests | ||
|
|
||
| ################################################################################ | ||
|
|
||
| # Create a stage for building the application based on the stage with downloaded dependencies. | ||
| # This Dockerfile is optimized for Java applications that output an uber jar, which includes | ||
| # all the dependencies needed to run your app inside a JVM. If your app doesn't output an uber | ||
| # jar and instead relies on an application server like Apache Tomcat, you'll need to update this | ||
| # stage with the correct filename of your package and update the base image of the "final" stage | ||
| # use the relevant app server, e.g., using tomcat (https://hub.docker.com/_/tomcat/) as a base image. | ||
| FROM deps as package | ||
|
|
||
| WORKDIR /build | ||
|
|
||
| COPY . src/ | ||
| RUN --mount=type=bind,source=pom.xml,target=pom.xml \ | ||
| --mount=type=cache,target=/root/.m2 \ | ||
| ./mvnw package -DskipTests && \ | ||
| mv target/$(./mvnw help:evaluate -Dexpression=project.artifactId -q -DforceStdout)-$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout).jar target/app.jar | ||
|
|
||
|
|
||
| ################################################################################ | ||
|
|
||
| # Create a new stage for running the application that contains the minimal | ||
| # runtime dependencies for the application. This often uses a different base | ||
| # image from the install or build stage where the necessary files are copied | ||
| # from the install stage. | ||
| # | ||
| # The example below uses eclipse-turmin's JRE image as the foundation for running the app. | ||
| # By specifying the "8-jre-jammy" tag, it will also use whatever happens to be the | ||
| # most recent version of that tag when you build your Dockerfile. | ||
| # If reproducibility is important, consider using a specific digest SHA, like | ||
| # eclipse-temurin@sha256:99cede493dfd88720b610eb8077c8688d3cca50003d76d1d539b0efc8cca72b4. | ||
| FROM eclipse-temurin:8-jre-jammy AS final | ||
|
|
||
| # Create a non-privileged user that the app will run under. | ||
| # See https://docs.docker.com/go/dockerfile-user-best-practices/ | ||
| ARG UID=10001 | ||
| RUN adduser \ | ||
| --disabled-password \ | ||
| --gecos "" \ | ||
| --home "/nonexistent" \ | ||
| --shell "/sbin/nologin" \ | ||
| --no-create-home \ | ||
| --uid "${UID}" \ | ||
| appuser | ||
| USER appuser | ||
|
|
||
| # Copy the executable from the "package" stage. | ||
| COPY --from=package build/target/app.jar app.jar | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| EXPOSE 8008 | ||
|
|
||
| ENTRYPOINT [ "java", "-jar", "app.jar" ] | ||
This file contains hidden or 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,19 @@ | ||
| ### Building and running your application | ||
|
|
||
| When you're ready, start your application by running: | ||
| `docker compose up --build`. | ||
|
|
||
| Your application will be available at http://localhost:8008. | ||
|
|
||
| ### Deploying your application to the cloud | ||
|
|
||
| First, build your image, e.g.: `docker build -t myapp .`. | ||
| If your cloud uses a different CPU architecture than your development | ||
| machine (e.g., you are on a Mac M1 and your cloud provider is amd64), | ||
| you'll want to build the image for that platform, e.g.: | ||
| `docker build --platform=linux/amd64 -t myapp .`. | ||
|
|
||
| Then, push it to your registry, e.g. `docker push myregistry.com/myapp`. | ||
|
|
||
| Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/) | ||
| docs for more detail on building and pushing. |
This file contains hidden or 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,49 @@ | ||
| # Comments are provided throughout this file to help you get started. | ||
| # If you need more help, visit the Docker Compose reference guide at | ||
| # https://docs.docker.com/go/compose-spec-reference/ | ||
|
|
||
| # Here the instructions define your application as a service called "server". | ||
| # This service is built from the Dockerfile in the current directory. | ||
| # You can add other services your application may depend on here, such as a | ||
| # database or a cache. For examples, see the Awesome Compose repository: | ||
| # https://github.com/docker/awesome-compose | ||
| services: | ||
| server: | ||
| build: | ||
| context: . | ||
| ports: | ||
| - 8008:8008 | ||
|
|
||
| # The commented out section below is an example of how to define a PostgreSQL | ||
| # database that your application can use. `depends_on` tells Docker Compose to | ||
| # start the database before your application. The `db-data` volume persists the | ||
| # database data between container restarts. The `db-password` secret is used | ||
| # to set the database password. You must create `db/password.txt` and add | ||
| # a password of your choosing to it before running `docker-compose up`. | ||
| # depends_on: | ||
| # db: | ||
| # condition: service_healthy | ||
| # db: | ||
| # image: postgres | ||
| # restart: always | ||
| # user: postgres | ||
| # secrets: | ||
| # - db-password | ||
| # volumes: | ||
| # - db-data:/var/lib/postgresql/data | ||
| # environment: | ||
| # - POSTGRES_DB=example | ||
| # - POSTGRES_PASSWORD_FILE=/run/secrets/db-password | ||
| # expose: | ||
| # - 5432 | ||
| # healthcheck: | ||
| # test: [ "CMD", "pg_isready" ] | ||
| # interval: 10s | ||
| # timeout: 5s | ||
| # retries: 5 | ||
| # volumes: | ||
| # db-data: | ||
| # secrets: | ||
| # db-password: | ||
| # file: db/password.txt | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.