File tree Expand file tree Collapse file tree
warehouse-postgres-docker Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build and Push Docker Image
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ paths :
8+ - ' warehouse-postgres-docker/**'
9+ workflow_dispatch :
10+
11+ env :
12+ REGISTRY : ghcr.io
13+ IMAGE_NAME : hackclub/warehouse-postgres
14+
15+ jobs :
16+ build-and-push :
17+ runs-on : ubuntu-latest
18+ permissions :
19+ contents : read
20+ packages : write
21+
22+ steps :
23+ - name : Checkout repository
24+ uses : actions/checkout@v4
25+ with :
26+ submodules : recursive
27+
28+ - name : Set up Docker Buildx
29+ uses : docker/setup-buildx-action@v3
30+
31+ - name : Log in to GitHub Container Registry
32+ uses : docker/login-action@v3
33+ with :
34+ registry : ${{ env.REGISTRY }}
35+ username : ${{ github.actor }}
36+ password : ${{ secrets.GITHUB_TOKEN }}
37+
38+ - name : Extract metadata (tags, labels) for Docker
39+ id : meta
40+ uses : docker/metadata-action@v5
41+ with :
42+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
43+ tags : |
44+ type=raw,value=17
45+ type=raw,value=17-{{sha}}
46+
47+ - name : Build and push Docker image
48+ uses : docker/build-push-action@v6
49+ with :
50+ context : ./warehouse-postgres-docker
51+ push : true
52+ tags : ${{ steps.meta.outputs.tags }}
53+ labels : ${{ steps.meta.outputs.labels }}
54+ cache-from : type=gha
55+ cache-to : type=gha,mode=max
56+
Original file line number Diff line number Diff line change 1+ [submodule "warehouse-postgres-docker/vendor/pg_xxhash "]
2+ path = warehouse-postgres-docker/vendor/pg_xxhash
3+ url = https://github.com/hatarist/pg_xxhash.git
Original file line number Diff line number Diff line change 1+ ARG BASE_IMAGE=postgres:17-alpine
2+
3+ # # Custom Alpine Postgres docker file with pg_xxhash extension
4+ FROM ${BASE_IMAGE} AS builder
5+
6+ # Install required dependencies for building the extension
7+ RUN apk --no-cache add \
8+ make \
9+ gcc \
10+ g++ \
11+ clang19 \
12+ llvm19 \
13+ postgresql-dev
14+
15+ # Copy the vendored pg_xxhash source
16+ COPY vendor/pg_xxhash /xxhash
17+
18+ WORKDIR /xxhash
19+
20+ # Build and install the extension
21+ RUN make && make install
22+
23+ # # Final image - start fresh from base
24+ FROM ${BASE_IMAGE}
25+
26+ # # Copy all extensions from the builder stage
27+ COPY --from=builder /usr/local/lib/postgresql/* /usr/local/lib/postgresql/
28+ COPY --from=builder /usr/local/share/postgresql/extension/* /usr/local/share/postgresql/extension/
29+
You can’t perform that action at this time.
0 commit comments