Skip to content

Commit cab04f0

Browse files
committed
fix
1 parent 4340f32 commit cab04f0

File tree

5 files changed

+61
-1
lines changed

5 files changed

+61
-1
lines changed

.editorconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[*.yml]
2+
indent_style = space
3+
indent_size = 2
4+
5+
[*.py]
6+
indent_style = space
7+
indent_size = 4
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish container package
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- seed
7+
tags:
8+
- v*
9+
env:
10+
IMAGE_NAME: example-backend
11+
#
12+
jobs:
13+
# This pushes the image to GitHub Packages.
14+
push:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
packages: write
18+
contents: read
19+
#
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Build image
24+
run: docker build . --file ./Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
25+
26+
- name: Log in to registry
27+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
28+
29+
- name: Push image
30+
run: |
31+
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
32+
33+
# This changes all uppercase characters to lowercase.
34+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
35+
36+
# This strips the git ref prefix from the version.
37+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
38+
39+
# This strips the "v" prefix from the tag name.
40+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
41+
42+
# This uses the Docker `latest` tag convention.
43+
[ "$VERSION" == "main" ] && VERSION=latest
44+
echo IMAGE_ID=$IMAGE_ID
45+
echo VERSION=$VERSION
46+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
47+
docker push $IMAGE_ID:$VERSION
File renamed without changes.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ ERROR_SUCCESS_COUNT=0 ERROR_FAILURE_COUNT=100 uv run app.py
3636
docker compose build
3737
```
3838

39+
or
40+
41+
```bash
42+
docker build -t example-backend .
43+
```
44+
3945
## Running in a Container
4046

4147
```bash

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ services:
22
backend-service:
33
build:
44
context: .
5-
dockerfile: container-images/example-backend/Dockerfile
5+
dockerfile: Dockerfile
66
image: example-backend:latest
77
container_name: backend
88
ports:

0 commit comments

Comments
 (0)