File tree Expand file tree Collapse file tree 7 files changed +70
-9
lines changed
Expand file tree Collapse file tree 7 files changed +70
-9
lines changed Original file line number Diff line number Diff line change 11name : " Build Docker"
22
3- on : workflow_call
3+ on :
4+ workflow_call :
5+ inputs :
6+ tag_prefix :
7+ description : ' The tag prefix to use'
8+ required : false
9+ type : string
10+ default : ' '
11+ dockerfile :
12+ description : ' The Dockerfile to use'
13+ required : false
14+ type : string
15+ default : ' Dockerfile'
16+
417jobs :
518 buildx :
619 runs-on : ubuntu-latest
2235 run : |
2336 REPO=ghcr.io/${{ github.repository }}
2437 TAG=$(git describe --tags)
25- echo "tag_flags=--tag $REPO:$TAG" >> $GITHUB_ENV
38+ echo "tag_flags=--tag $REPO:${{ inputs.tag_prefix }}$ TAG" >> $GITHUB_ENV
2639
2740 # New tagged version
2841 - name : Prepare version push tags
@@ -36,18 +49,18 @@ jobs:
3649 else
3750 TAG2="latest"
3851 fi
39- echo "tag_flags=--tag $REPO:$TAG --tag $REPO:$TAG2" >> $GITHUB_ENV
52+ echo "tag_flags=--tag $REPO:${{ inputs.tag_prefix }}$ TAG --tag $REPO:${{ inputs.tag_prefix }} $TAG2" >> $GITHUB_ENV
4053
4154 # Every pull request
4255 - name : Prepare pull request tags
4356 if : github.event_name == 'pull_request'
4457 run : |
4558 echo "tag_flags=--tag ${{ github.ref }}" >> $GITHUB_ENV
4659 REPO=ghcr.io/${{ github.repository }}
47- echo "tag_flags=--tag $REPO:pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
60+ echo "tag_flags=--tag $REPO:${{ inputs.tag_prefix }} pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
4861
4962 - name : Buildx
5063 run : |
5164 set -x
5265 echo "${{ secrets.GITHUB_TOKEN }}" | docker login -u "${{ github.repository_owner }}" --password-stdin ghcr.io
53- make buildx CONTAINER_BUILDX_OPTIONS="--push ${{ env.tag_flags }}"
66+ make buildx CONTAINERFILE_NAME=${{ inputs.dockerfile }} CONTAINER_BUILDX_OPTIONS="--push ${{ env.tag_flags }}"
Original file line number Diff line number Diff line change 3131 # only build on pull requests from the same repo for now
3232 if : github.event.pull_request.head.repo.full_name == github.repository
3333 uses : ./.github/workflows/_buildx.yml
34+ call-buildx-alpine :
35+ needs : call-gorelease
36+ # only build on pull requests from the same repo for now
37+ if : github.event.pull_request.head.repo.full_name == github.repository
38+ uses : ./.github/workflows/_buildx.yml
39+ with :
40+ tag_prefix : alpine-
41+ dockerfile : Dockerfile.alpine
Original file line number Diff line number Diff line change 2424 call-buildx :
2525 needs : call-gorelease
2626 uses : ./.github/workflows/_buildx.yml
27+ call-buildx-alpine :
28+ needs : call-gorelease
29+ # only build on pull requests from the same repo for now
30+ if : github.event.pull_request.head.repo.full_name == github.repository
31+ uses : ./.github/workflows/_buildx.yml
32+ with :
33+ tag_prefix : alpine-
34+ dockerfile : Dockerfile.alpine
Original file line number Diff line number Diff line change 3636 call-buildx :
3737 needs : call-gorelease
3838 uses : ./.github/workflows/_buildx.yml
39+ call-buildx-alpine :
40+ needs : call-gorelease
41+ # only build on pull requests from the same repo for now
42+ if : github.event.pull_request.head.repo.full_name == github.repository
43+ uses : ./.github/workflows/_buildx.yml
44+ with :
45+ tag_prefix : alpine-
46+ dockerfile : Dockerfile.alpine
Original file line number Diff line number Diff line change 11# Build stage
2- ARG ALPINE_VERSION
3- ARG GOLANG_VERSION
2+ ARG ALPINE_VERSION=3.19
43
54FROM docker.io/library/alpine:${ALPINE_VERSION} AS builder
65ARG TARGETARCH
@@ -14,7 +13,7 @@ RUN apk add --no-cache ca-certificates tzdata && \
1413# Server image
1514FROM scratch
1615
17- ENV PORT 8080
16+ ENV PORT= 8080
1817ENV SHIORI_DIR=/shiori
1918WORKDIR ${SHIORI_DIR}
2019
Original file line number Diff line number Diff line change 1+ ARG ALPINE_VERSION=3.19
2+
3+ FROM docker.io/library/alpine:${ALPINE_VERSION}
4+ ARG TARGETARCH
5+ ARG TARGETOS
6+ ARG TARGETVARIANT
7+ COPY dist/shiori_${TARGETOS}_${TARGETARCH}${TARGETVARIANT}/shiori /usr/bin/shiori
8+ RUN apk add --no-cache ca-certificates tzdata && \
9+ chmod +x /usr/bin/shiori && \
10+ rm -rf /tmp/* && \
11+ apk cache clean
12+
13+ ENV PORT=8080
14+ ENV SHIORI_DIR=/shiori
15+ WORKDIR ${SHIORI_DIR}
16+
17+ LABEL org.opencontainers.image.source="https://github.com/go-shiori/shiori"
18+ LABEL maintainer="Felipe Martin <github@fmartingr.com>"
19+
20+ EXPOSE ${PORT}
21+
22+ ENTRYPOINT ["/usr/bin/shiori"]
23+ CMD ["server"]
Original file line number Diff line number Diff line change @@ -34,8 +34,10 @@ The above command will :
3434
3535After you've run the container in background, you can access console of the container:
3636
37+ > In order to be able to access the container and execute commands you need to use the ` alpine- ` prefixed images.
38+
3739```
38- docker exec -it shiori sh
40+ docker exec -it shiori ash
3941```
4042
4143Now you can use ` shiori ` like normal. If you've finished, you can stop and remove the container by running :
You can’t perform that action at this time.
0 commit comments