Skip to content

Commit 89c2ef4

Browse files
ci: build & publish release image (#710)
1 parent 3809509 commit 89c2ef4

File tree

5 files changed

+66
-105
lines changed

5 files changed

+66
-105
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,6 @@ env:
1313
RUST_TOOLCHAIN: nightly-2024-11-29
1414

1515
jobs:
16-
docker:
17-
runs-on: ubuntu-latest
18-
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
19-
steps:
20-
- name: Checkout repository
21-
uses: actions/checkout@v4
22-
23-
- name: Set up Docker Buildx
24-
uses: docker/setup-buildx-action@v3
25-
26-
- name: Build Docker image
27-
uses: docker/build-push-action@v5
28-
with:
29-
context: .
30-
push: false
31-
load: true
32-
cache-from: type=gha
33-
cache-to: type=gha,mode=max
34-
3516
machete:
3617
runs-on: ubuntu-latest
3718

.github/workflows/publish.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish
2+
on:
3+
push:
4+
branches: [ main ]
5+
env:
6+
CARGO_TERM_COLOR: always
7+
RUST_TOOLCHAIN: nightly-2024-11-29
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
# Add permission to push to GHCR
14+
permissions:
15+
contents: read
16+
packages: write
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Log in to GitHub Container Registry
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ${{ env.REGISTRY }}
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Build and push hyperion-proxy
32+
uses: docker/build-push-action@v5
33+
with:
34+
context: .
35+
push: true
36+
target: hyperion-proxy
37+
tags: |
38+
${{ env.REGISTRY }}/${{ github.repository }}/hyperion-proxy:latest
39+
${{ env.REGISTRY }}/${{ github.repository }}/hyperion-proxy:${{ github.sha }}
40+
cache-from: type=gha
41+
cache-to: type=gha,mode=max
42+
43+
- name: Build and push tag
44+
uses: docker/build-push-action@v5
45+
with:
46+
context: .
47+
push: true
48+
target: tag
49+
tags: |
50+
${{ env.REGISTRY }}/${{ github.repository }}/tag:latest
51+
${{ env.REGISTRY }}/${{ github.repository }}/tag:${{ github.sha }}
52+
cache-from: type=gha
53+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,6 @@ RUN --mount=type=cache,target=${CARGO_HOME}/registry \
4747
--mount=type=cache,target=/app/target \
4848
cargo fetch
4949

50-
# Debug builder
51-
FROM builder-base AS build-debug
52-
ARG CARGO_HOME
53-
RUN --mount=type=cache,target=${CARGO_HOME}/registry \
54-
--mount=type=cache,target=${CARGO_HOME}/git \
55-
--mount=type=cache,target=/app/target \
56-
cargo build --frozen && \
57-
mkdir -p /app/build && \
58-
cp target/debug/hyperion-proxy /app/build/ && \
59-
cp target/debug/tag /app/build/
60-
6150
# Release builder
6251
FROM builder-base AS build-release
6352
ARG CARGO_HOME
@@ -79,40 +68,20 @@ RUN apt-get update && \
7968
ENV RUST_BACKTRACE=1 \
8069
RUST_LOG=info
8170

82-
# Hyperion Proxy Debug
83-
FROM runtime-base AS hyperion-proxy-debug
84-
COPY --from=build-debug /app/build/hyperion-proxy /
85-
LABEL org.opencontainers.image.source="https://github.com/yourusername/hyperion-proxy" \
86-
org.opencontainers.image.description="Debug Build - Hyperion Proxy Server" \
87-
org.opencontainers.image.version="1.0.0"
88-
EXPOSE 8080
89-
ENTRYPOINT ["/hyperion-proxy"]
90-
CMD ["0.0.0.0:8080"]
91-
9271
# Hyperion Proxy Release
93-
FROM runtime-base AS hyperion-proxy-release
72+
FROM runtime-base AS hyperion-proxy
9473
COPY --from=build-release /app/build/hyperion-proxy /
95-
LABEL org.opencontainers.image.source="https://github.com/yourusername/hyperion-proxy" \
96-
org.opencontainers.image.description="Release Build - Hyperion Proxy Server" \
97-
org.opencontainers.image.version="1.0.0"
74+
LABEL org.opencontainers.image.source="https://github.com/andrewgazelka/hyperion" \
75+
org.opencontainers.image.description="Hyperion Proxy Server" \
76+
org.opencontainers.image.version="0.1.0"
9877
EXPOSE 8080
9978
ENTRYPOINT ["/hyperion-proxy"]
10079
CMD ["0.0.0.0:8080"]
101-
102-
# NYC Debug
103-
FROM runtime-base AS tag-debug
104-
COPY --from=build-debug /app/build/tag /
105-
LABEL org.opencontainers.image.source="https://github.com/yourusername/tag" \
106-
org.opencontainers.image.description="Debug Build - NYC Server" \
107-
org.opencontainers.image.version="1.0.0"
108-
ENTRYPOINT ["/tag"]
109-
CMD ["--ip", "0.0.0.0", "--port", "35565"]
110-
11180
# NYC Release
112-
FROM runtime-base AS tag-release
81+
FROM runtime-base AS tag
11382
COPY --from=build-release /app/build/tag /
114-
LABEL org.opencontainers.image.source="https://github.com/yourusername/tag" \
115-
org.opencontainers.image.description="Release Build - NYC Server" \
116-
org.opencontainers.image.version="1.0.0"
83+
LABEL org.opencontainers.image.source="https://github.com/andrewgazelka/hyperion" \
84+
org.opencontainers.image.description="Hyperion Tag Event" \
85+
org.opencontainers.image.version="0.1.0"
11786
ENTRYPOINT ["/tag"]
11887
CMD ["--ip", "0.0.0.0", "--port", "35565"]

docker-compose.release.yml

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

docker-compose.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
1-
version: '3.8'
21
services:
32
hyperion-proxy:
4-
build:
5-
context: .
6-
dockerfile: Dockerfile
7-
target: hyperion-proxy-debug
3+
image: ghcr.io/andrewgazelka/hyperion/hyperion-proxy:latest
84
ports:
95
- "25565:25565"
10-
command: [ "--server", "tag:35565", "0.0.0.0:25565" ] # Fixed argument order and format
6+
command: [ "--server", "tag:35565", "0.0.0.0:25565" ]
117
restart: unless-stopped
128
environment:
139
- RUST_LOG=info
1410
networks:
1511
- proxy-network
1612
depends_on:
1713
- tag
18-
1914
tag:
20-
build:
21-
context: .
22-
dockerfile: Dockerfile
23-
target: tag-debug
15+
image: ghcr.io/andrewgazelka/hyperion/tag:latest
2416
ports:
2517
- "27750:27750"
2618
expose:
2719
- "35565"
28-
command: [] # ["--ip", "0.0.0.0", "--port", "35565"]
20+
command: [ ]
2921
restart: unless-stopped
3022
environment:
3123
- RUST_LOG=info
@@ -34,4 +26,4 @@ services:
3426

3527
networks:
3628
proxy-network:
37-
driver: bridge
29+
driver: bridge

0 commit comments

Comments
 (0)