Skip to content

Commit c35f660

Browse files
authored
set user home (#13)
1 parent 5efc4a7 commit c35f660

File tree

7 files changed

+41
-23
lines changed

7 files changed

+41
-23
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,57 @@ name: build
33
on:
44
workflow_call:
55
inputs:
6-
push:
6+
deploy:
77
type: boolean
88
default: false
99

1010
workflow_dispatch:
1111
inputs:
12-
push:
12+
deploy:
1313
type: boolean
1414
default: false
1515

1616
jobs:
1717
build:
1818
runs-on: ubuntu-latest
1919

20+
defaults:
21+
run:
22+
shell: bash
23+
2024
steps:
2125
- name: Checkout
22-
uses: actions/checkout@v4.2.2
26+
uses: actions/checkout@v6.0.2
2327

2428
- name: Set up QEMU
25-
uses: docker/setup-qemu-action@v3.6.0
29+
uses: docker/setup-qemu-action@v4.0.0
2630

2731
- name: Set up Docker Buildx
28-
uses: docker/setup-buildx-action@v3.11.1
32+
uses: docker/setup-buildx-action@v4.0.0
2933

3034
- name: Log in to Docker Hub
31-
if: ${{ inputs.push }}
32-
uses: docker/login-action@v3.4.0
35+
uses: docker/login-action@v4.0.0
3336
with:
3437
username: ${{ secrets.DOCKERHUB_USER }}
3538
password: ${{ secrets.DOCKERHUB_TOKEN }}
3639

3740
- name: Extract Docker metadata
3841
id: meta
39-
uses: docker/metadata-action@v5.7.0
42+
uses: docker/metadata-action@v6.0.0
4043
with:
4144
images: ${{ secrets.DOCKERHUB_USER }}/join-ci
4245
tags: |
4346
type=ref,event=branch
4447
type=sha
4548
type=raw,value=latest,enable={{is_default_branch}}
4649
47-
- name: Build and push Docker image
48-
uses: docker/build-push-action@v6.18.0
50+
- name: Build and Deploy Docker image
51+
uses: docker/build-push-action@v7.0.0
4952
with:
5053
context: .
51-
push: ${{ inputs.push }}
54+
push: ${{ inputs.deploy }}
5255
platforms: linux/amd64,linux/arm64
5356
tags: ${{ steps.meta.outputs.tags }}
5457
labels: ${{ steps.meta.outputs.labels }}
58+
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USER }}/join-ci:buildcache
59+
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USER }}/join-ci:buildcache,mode=max
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
name: image
1+
name: cd
22

33
on:
44
push:
55
branches: [ main ]
66

7+
workflow_dispatch:
8+
79
jobs:
8-
push:
10+
deploy:
911
uses: ./.github/workflows/build.yml
12+
1013
secrets: inherit
14+
1115
with:
12-
push: true
16+
deploy: true
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
name: pr
1+
name: ci
22

33
on:
44
pull_request:
55
branches: [ main ]
66

7+
workflow_dispatch:
8+
79
jobs:
8-
test:
10+
check:
911
uses: ./.github/workflows/build.yml
12+
1013
secrets: inherit
11-
with:
12-
push: false

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ RUN apt-get update && bash -xe ./01*.sh && rm -rf * && rm -rf /var/lib/apt/lists
1616
COPY scripts/02*.sh .
1717
RUN apt-get update && bash -xe ./02*.sh && rm -rf * && rm -rf /var/lib/apt/lists/*
1818

19+
USER root
20+
ENV HOME=/root
1921
WORKDIR /github/workspace
2022

2123
CMD ["/bin/bash"]

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ This is an Ubuntu based docker image, with all the mandatory tools for the join
99

1010
To create the docker image do this:
1111
```bash
12-
docker build -t joinframework/join-ci .
12+
docker buildx build --platform linux/amd64,linux/arm64 -t joinframework/join-ci .
13+
```
14+
15+
To create and test locally for a single platform do this:
16+
```bash
17+
docker buildx build --platform linux/amd64 --load -t joinframework/join-ci .
1318
```
1419

1520
## Testing image

scripts/01_install_dependencies.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ apt-get -qq install \
2020
clang \
2121
llvm \
2222
ninja-build \
23-
wget \
2423
python3 \
2524
python3-pip \
2625
bash \
2726
jq \
2827
libc6-dev \
29-
libglib2.0-0 \
28+
libglib2.0-dev \
3029
libtrace-tools \
3130
lcov \
3231
libclang-rt-dev \

scripts/02_install_hugo.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ else
1313
fi
1414

1515
wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-${HUGO_ARCH}.tar.gz
16-
tar -xvzf hugo_extended_${HUGO_VERSION}_linux-${HUGO_ARCH}.tar.gz
16+
wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_checksums.txt
17+
grep "hugo_extended_${HUGO_VERSION}_linux-${HUGO_ARCH}.tar.gz" hugo_${HUGO_VERSION}_checksums.txt | sha256sum -c -
18+
tar -xzf hugo_extended_${HUGO_VERSION}_linux-${HUGO_ARCH}.tar.gz
1719
mv hugo /usr/local/bin/
18-
rm hugo_extended_${HUGO_VERSION}_linux-${HUGO_ARCH}.tar.gz LICENSE README.md
20+
rm hugo_extended_${HUGO_VERSION}_linux-${HUGO_ARCH}.tar.gz hugo_${HUGO_VERSION}_checksums.txt LICENSE README.md

0 commit comments

Comments
 (0)