Skip to content

Commit

Permalink
Merge https://github.com/cisagov/skeleton-docker into lineage/skeleton
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
#	compose.yml
  • Loading branch information
mcdonnnj committed Feb 7, 2025
2 parents 3454986 + eafe720 commit 183b7f1
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 30 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -419,16 +419,14 @@ jobs:
path: ${{ env.BUILDX_CACHE_DIR }}
restore-keys: |
${{ env.BASE_CACHE_KEY }}
- name: Create cross-platform support Dockerfile-x
run: ./buildx-dockerfile.sh
- name: Build and push platform images to registries
id: docker_build
uses: docker/build-push-action@v6
with:
cache-from: type=local,src=${{ env.BUILDX_CACHE_DIR }}
cache-to: type=local,dest=${{ env.BUILDX_CACHE_DIR }}
context: .
file: ./Dockerfile-x
file: ./Dockerfile
labels: ${{ needs.prepare.outputs.labels }}
platforms: |
linux/amd64
Expand Down
52 changes: 45 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ docker run cisagov/example:0.2.0
### Running with Docker Compose ###

1. Create a `docker-compose.yml` file similar to the one below to use [Docker Compose](https://docs.docker.com/compose/).
1. Create a `compose.yml` file similar to the one below to use [Docker Compose](https://docs.docker.com/compose/).

```yaml
---
version: "3.7"
name: skeleton-docker

secrets:
credentials:
Expand All @@ -49,6 +49,7 @@ docker run cisagov/example:0.2.0
restart: "no"
=======
example:
<<<<<<< HEAD
image: cisagov/example:0.2.0
volumes:
- type: bind
Expand All @@ -63,6 +64,19 @@ docker run cisagov/example:0.2.0
secrets:
- source: credentials
target: credentials
=======
environment:
- ECHO_MESSAGE="Hello from docker compose"
image: cisagov/example:0.2.0
ports:
- protocol: tcp
published: "8080"
target: 8080
volumes:
- source: <your_log_dir>
target: /var/log
type: bind
>>>>>>> eafe720594319b9503bd5e6d7e5b59e61ff9d6d5
```

#### Issue a new certificate ####
Expand Down Expand Up @@ -141,11 +155,11 @@ want set:
credential_source = Ec2InstanceMetadata
```

1. Then add the secret to your `docker-compose.yml` file:
1. Then add the secret to your `compose.yml` file:

```yaml
---
version: "3.7"
name: skeleton-docker
secrets:
credentials:
Expand All @@ -159,6 +173,7 @@ want set:
restart: "no"
=======
example:
<<<<<<< HEAD
image: cisagov/example:0.2.0
volumes:
- type: bind
Expand All @@ -173,6 +188,22 @@ want set:
secrets:
- source: credentials
target: credentials
=======
environment:
- ECHO_MESSAGE="Hello from docker compose"
image: cisagov/example:0.2.0
ports:
- protocol: tcp
published: "8080"
target: 8080
secrets:
- source: quote_txt
target: quote.txt
volumes:
- source: <your_log_dir>
target: /var/log
type: bind
>>>>>>> eafe720594319b9503bd5e6d7e5b59e61ff9d6d5
```

## Updating your container ##
Expand Down Expand Up @@ -249,9 +280,9 @@ If you want to add or remove dependencies you would update the `src/Pipfile` fil
and then update dependencies as you would above.

> [!NOTE]
> You should only specify packages that are explicitly needed for your Docker
> configuration. Allow [Pipenv] to manage the dependencies of the specified
> packages.
> You should only specify packages that are direct requirements of
> your Docker configuration. Allow [Pipenv] to manage the dependencies
> of the specified packages.

## Image tags ##

Expand Down Expand Up @@ -290,8 +321,15 @@ There are no exposed ports.
<!--
| Port | Purpose |
|------|----------------|
<<<<<<< HEAD
| PORT_NUMBER | Describe its purpose. |
-->
=======
| 8080 | Example only; nothing is actually listening on the port |

The sample [Docker composition](compose.yml) publishes the
exposed port at 8080.
>>>>>>> eafe720594319b9503bd5e6d7e5b59e61ff9d6d5

## Environment variables ##

Expand Down
15 changes: 0 additions & 15 deletions buildx-dockerfile.sh

This file was deleted.

24 changes: 19 additions & 5 deletions docker-compose.yml → compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
version: "3.7"

# This Docker composition file is used to build and test the container

name: skeleton-docker

secrets:
credentials:
file: ./src/secrets/credentials
Expand All @@ -15,9 +15,12 @@ services:
# e.g., --build-arg VERSION=0.0.1
context: .
dockerfile: Dockerfile
<<<<<<< HEAD:docker-compose.yml
image: cisagov/certboto
init: true
restart: "no"
=======
>>>>>>> eafe720594319b9503bd5e6d7e5b59e61ff9d6d5:compose.yml
environment:
<<<<<<< HEAD
- AWS_DEFAULT_REGION=us-east-1
Expand All @@ -26,19 +29,30 @@ services:
- DNS_PROFILE=dns-role
=======
- ECHO_MESSAGE=Hello World from docker compose!
image: cisagov/example
init: true
ports:
- target: 8421
published: 8421
- mode: host
protocol: tcp
<<<<<<< HEAD:docker-compose.yml
mode: host
>>>>>>> 0d48ebd47a28a887868ea3093e675e95f3843561
=======
published: "8421"
target: 8421
restart: "no"
>>>>>>> eafe720594319b9503bd5e6d7e5b59e61ff9d6d5:compose.yml
secrets:
- source: credentials
target: credentials

certboto-version:
# Run the container to collect version information
<<<<<<< HEAD:docker-compose.yml
image: cisagov/certboto
=======
command: --version
image: cisagov/example
>>>>>>> eafe720594319b9503bd5e6d7e5b59e61ff9d6d5:compose.yml
init: true
restart: "no"
command: --version
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
--requirement requirements-test.txt
ipython
pipenv
# The bump-version script requires at least version 3 of semver.
semver>=3

0 comments on commit 183b7f1

Please sign in to comment.