Skip to content

Commit fa8600c

Browse files
committed
ci: testing
1 parent 6c48259 commit fa8600c

4 files changed

Lines changed: 100 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
pull_request:
66

77
jobs:
8-
ci:
8+
ci_1:
99
env:
1010
IMAGE_NAME: "hex_tiny"
1111

@@ -17,3 +17,15 @@ jobs:
1717
- name: Build Docker Image
1818
run: docker build -t $IMAGE_NAME:latest -f docker/Dockerfile .
1919

20+
ci_2:
21+
env:
22+
IMAGE_NAME: "hex_beefy"
23+
24+
runs-on: ubuntu-24.04
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Build Docker Image
30+
run: docker build -t $IMAGE_NAME:latest -f docker/Dockerfile_beefy .
31+

.github/workflows/publish.yml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ on:
1414
types: [published]
1515

1616
jobs:
17-
push_to_registry:
18-
name: Push Docker image to Docker Hub
17+
push_to_registry_1:
18+
name: Push Docker image to Docker Hub (1)
1919
runs-on: ubuntu-latest
2020
permissions:
2121
packages: write
@@ -46,3 +46,36 @@ jobs:
4646
push: true
4747
tags: ${{ steps.meta.outputs.tags }}
4848
labels: ${{ steps.meta.outputs.labels }}
49+
50+
push_to_registry_2:
51+
name: Push Docker image to Docker Hub (2)
52+
runs-on: ubuntu-latest
53+
permissions:
54+
packages: write
55+
contents: read
56+
id-token: write
57+
steps:
58+
- name: Check out the repo
59+
uses: actions/checkout@v4
60+
61+
- name: Log in to Docker Hub
62+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
63+
with:
64+
username: ${{ secrets.DOCKER_USERNAME }}
65+
password: ${{ secrets.DOCKER_PASSWORD }}
66+
67+
- name: Extract metadata (tags, labels) for Docker
68+
id: meta
69+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
70+
with:
71+
images: camatcode/hex_beefy
72+
73+
- name: Build and push Docker image
74+
id: push
75+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
76+
with:
77+
context: .
78+
file: ./docker/Dockerfile_beefy
79+
push: true
80+
tags: ${{ steps.meta.outputs.tags }}
81+
labels: ${{ steps.meta.outputs.labels }}

docker/Dockerfile_beefy

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM postgres:17-alpine3.21 as build
2+
3+
4+
FROM elixir:1.18-alpine as e_build
5+
6+
COPY --from=build / /
7+
8+
9+
RUN apk add openssl-dev --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
10+
RUN apk add git
11+
12+
WORKDIR /code
13+
14+
RUN git clone https://github.com/hexpm/hexpm.git --single-branch
15+
16+
WORKDIR /code/hexpm
17+
18+
RUN apk add make --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
19+
RUN apk add g++ --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
20+
RUN apk add yarn inotify-tools
21+
RUN mix deps.get && mix compile
22+
RUN chmod 777 -R /tmp
23+
RUN chown -R postgres: /code
24+
USER postgres
25+
ENV POSTGRES_USER="postgres"
26+
ENV POSTGRES_PASSWORD="postgres"
27+
ENV PGDATA="/var/lib/postgresql/data/pgdata"
28+
RUN initdb
29+
RUN postgres & mix setup
30+
31+
32+
FROM elixir:1.18-alpine as e_2_build
33+
USER postgres
34+
ENV POSTGRES_USER="postgres"
35+
ENV POSTGRES_PASSWORD="postgres"
36+
ENV PGDATA="/var/lib/postgresql/data/pgdata"
37+
38+
COPY --from=e_build / /
39+
WORKDIR /code/hexpm
40+
RUN touch log
41+
COPY docker/beefy_entrypoint.sh /code/hexpm/
42+
43+
EXPOSE 4000
44+
ENTRYPOINT ["/code/hexpm/beefy_entrypoint.sh"]
45+
46+

docker/beefy_entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
postgres > log 2>&1 &
3+
sleep 1
4+
cat log
5+
cd /code/hexpm/ && iex -S mix phx.server
6+

0 commit comments

Comments
 (0)