-
Notifications
You must be signed in to change notification settings - Fork 0
Add example Dockerfile and docker-compose #1
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Example Dockerfile for docker-template | ||
| FROM alpine:3 | ||
|
|
||
| # Set a working directory | ||
| WORKDIR /app | ||
|
|
||
| # Default command prints a message | ||
| CMD ["sh", "-c", "echo Hello from docker-template"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running containers as a non-root user is a critical security best practice. The container will run as the Please add instructions to create a non-root user and switch to it before the |
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,2 +1,14 @@ | ||||||
| # docker-template | ||||||
| A template for maintaining docker images using github Actions to automate Packages | ||||||
| A template for maintaining docker images using GitHub Actions to automate Packages. | ||||||
|
|
||||||
| This repository includes a simple example `Dockerfile` and accompanying `docker-compose.yml` to demonstrate how you might build and run a container. | ||||||
|
|
||||||
| ## Build the image | ||||||
| ```sh | ||||||
| docker build -t docker-template . | ||||||
| ``` | ||||||
|
|
||||||
| ## Run with Docker Compose | ||||||
| ```sh | ||||||
| docker compose up | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's common to run services in the background using detached mode ( Consider also mentioning
Suggested change
|
||||||
| ``` | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| version: '3' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| services: | ||
| app: | ||
| build: . | ||
| container_name: docker-template-example | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoding It's better to let Docker Compose manage container names automatically. I recommend removing this line to follow best practices and allow for scalability. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reproducible builds, it's a best practice to pin the base image to a specific version instead of using a floating tag like
:3. This prevents unexpected changes or build failures when the base image is updated.Consider using a more specific tag, for example
alpine:3.19.