Skip to content

Commit 3d9d636

Browse files
authored
Merge pull request #18 from flatcar-linux/jepio/publish-docker-container
Update dockerfile and add github action to publish docker images.
2 parents d00c766 + ff2c550 commit 3d9d636

File tree

5 files changed

+57
-13
lines changed

5 files changed

+57
-13
lines changed

.github/workflows/docker.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build docker image
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
env:
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME: flatcar-linux/ct
9+
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
steps:
17+
18+
- name: Get tag name
19+
id: meta
20+
uses: docker/metadata-action@v3
21+
with:
22+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
23+
24+
- name: Checkout repository
25+
uses: actions/checkout@v2
26+
27+
- name: Setup QEMU
28+
uses: docker/setup-qemu-action@v1
29+
with:
30+
platforms: all
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v1
34+
35+
- name: Login to registry
36+
uses: docker/login-action@v1
37+
with:
38+
registry: ${{ env.REGISTRY }}
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Build and push
43+
uses: docker/build-push-action@v2
44+
with:
45+
context: .
46+
push: true
47+
platforms: linux/amd64,linux/arm64/v8
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ COPY . .
55
RUN apk update && apk add --virtual .build-deps bash git make \
66
&& make \
77
&& mv bin/ct /usr/bin/ \
8-
&& mv Dockerfile.build-alpine /tmp \
98
&& rm -rf $GOPATH \
109
&& apk del .build-deps && rm -rf /var/cache/apk
11-
WORKDIR /tmp
12-
ENTRYPOINT ["/usr/bin/ct"]
10+
11+
FROM scratch
12+
COPY --from=0 /usr/bin/ct /ct
13+
ENTRYPOINT ["/ct"]

Dockerfile.build-alpine

Lines changed: 0 additions & 3 deletions
This file was deleted.

docker-build

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22

33
set -e
44
VERSION=$(git describe)
5-
docker build -t $VERSION .
6-
docker run --rm --entrypoint tar $VERSION -c /usr/bin/ct Dockerfile.build-alpine \
7-
| docker build -f Dockerfile.build-alpine --tag quay.io/coreos/ct:$VERSION -
8-
docker tag quay.io/coreos/ct:$VERSION quay.io/coreos/ct:latest-dev
5+
docker build --tag ghcr.io/flatcar-linux/ct:$VERSION .
6+
docker tag ghcr.io/flatcar-linux/ct:$VERSION ghcr.io/flatcar-linux/ct:latest-dev

docker-push

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22

33
set -e
44
VERSION=$(git describe)
5-
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" quay.io
6-
docker push quay.io/coreos/ct:$VERSION
7-
docker push quay.io/coreos/ct:latest-dev
5+
docker push ghcr.io/flatcar-linux/ct:$VERSION
6+
docker push ghcr.io/flatcar-linux/ct:latest-dev

0 commit comments

Comments
 (0)