Skip to content

Commit 4ce7cd6

Browse files
committed
build: update Dockerfile and CI configuration for improved compatibility and dependencies
1 parent cc8f78e commit 4ce7cd6

File tree

4 files changed

+69
-26
lines changed

4 files changed

+69
-26
lines changed

.github/workflows/docker.yml

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,65 @@ on:
44
pull_request:
55
branches:
66
- master
7+
- gcc-15
78
push:
89
branches:
910
- master
11+
- gcc-15
12+
tags:
13+
- "v*" # Construir también cuando se sube un tag v1.0, etc.
1014
schedule:
1115
- cron: "0 0 * * *"
1216
repository_dispatch:
1317
types: [run_build]
1418

19+
env:
20+
REGISTRY_IMAGE: vitasdk/buildscripts
21+
1522
jobs:
1623
build:
1724
runs-on: ubuntu-latest
18-
1925
steps:
20-
- uses: actions/checkout@v3
21-
22-
- name: Set up QEMU
23-
uses: docker/setup-qemu-action@v2
24-
25-
- name: Set up Docker Buildx
26-
uses: docker/setup-buildx-action@v2
27-
28-
- name: Login to DockerHub
29-
uses: docker/login-action@v2
30-
with:
31-
username: ${{ secrets.DOCKER_USERNAME }}
32-
password: ${{ secrets.DOCKER_PASSWORD }}
33-
if: github.event_name != 'pull_request'
34-
35-
- uses: docker/build-push-action@v3
36-
with:
37-
push: ${{ github.event_name != 'pull_request' }}
38-
tags: vitasdk/buildscripts:latest
26+
- uses: actions/checkout@v4
27+
28+
# Genera tags y labels automáticamente
29+
# master -> vitasdk/buildscripts:master, vitasdk/buildscripts:latest
30+
# PR #5 -> vitasdk/buildscripts:pr-5
31+
# Tag v1.0 -> vitasdk/buildscripts:1.0, vitasdk/buildscripts:latest
32+
- name: Docker meta
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: ${{ env.REGISTRY_IMAGE }}
37+
tags: |
38+
type=ref,event=branch
39+
type=ref,event=pr
40+
type=semver,pattern={{version}}
41+
type=semver,pattern={{major}}.{{minor}}
42+
type=raw,value=latest,enable={{is_default_branch}}
43+
44+
- name: Set up QEMU
45+
uses: docker/setup-qemu-action@v3
46+
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v3
49+
50+
- name: Login to DockerHub
51+
if: github.event_name != 'pull_request'
52+
uses: docker/login-action@v3
53+
with:
54+
username: ${{ secrets.DOCKER_USERNAME }}
55+
password: ${{ secrets.DOCKER_PASSWORD }}
56+
57+
- name: Build and push
58+
uses: docker/build-push-action@v5
59+
with:
60+
context: .
61+
push: ${{ github.event_name != 'pull_request' }}
62+
tags: ${{ steps.meta.outputs.tags }}
63+
labels: ${{ steps.meta.outputs.labels }}
64+
# Construir para amd64 (estándar) y arm64 (Apple Silicon, RPi)
65+
platforms: linux/amd64,linux/arm64
66+
# Habilitar caché de GitHub Actions
67+
cache-from: type=gha
68+
cache-to: type=gha,mode=max

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi
220220
URL http://ftp.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.bz2
221221
URL_HASH ${GMP_HASH}
222222
DOWNLOAD_DIR ${DOWNLOAD_DIR}
223-
CONFIGURE_COMMAND CPPFLAGS=-fexceptions ${compiler_flags} ${wrapper_command} <SOURCE_DIR>/configure
223+
CONFIGURE_COMMAND CFLAGS=-std=gnu99 CPPFLAGS=-fexceptions ${compiler_flags} ${wrapper_command} <SOURCE_DIR>/configure
224224
--build=${build_native}
225225
--host=${toolchain_host}
226226
--prefix=${toolchain_deps_dir}

Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# First stage of Dockerfile
2-
FROM alpine:3.12
2+
FROM alpine:latest AS build
3+
4+
RUN apk add build-base cmake git bash autoconf automake libtool texinfo patch pkgconfig python3 && ln -sf python3 /usr/bin/python
35

46
COPY . /src
57

6-
RUN apk add build-base cmake git bash autoconf automake libtool texinfo patch pkgconfig python3 && ln -sf python3 /usr/bin/python
7-
RUN cd /src && mkdir build && cd build && cmake .. && make -j$(nproc)
8+
RUN cd /src && mkdir build && cd build && cmake .. && make
9+
# -j$(nproc)
810

911
# Second stage of Dockerfile
1012
FROM alpine:latest
1113

14+
# Instalar dependencias en tiempo de ejecución para que la imagen sea útil
15+
RUN apk add --no-cache bash git make cmake python3
16+
1217
ENV VITASDK /usr/local/vitasdk
1318
ENV PATH ${VITASDK}/bin:$PATH
1419

cmake/GetTriplet.cmake

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ function(get_host_triplet triplet)
99

1010
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
1111
string(TOLOWER ${CMAKE_SYSTEM_NAME} host_os)
12-
set(host_release "gnu")
12+
if(EXISTS "/etc/alpine-release")
13+
set(host_release "musl")
14+
else()
15+
set(host_release "gnu")
16+
endif()
1317
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
1418
set(host_os "w64")
1519
set(host_release "mingw32")
@@ -38,7 +42,11 @@ function(get_build_triplet triplet)
3842

3943
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
4044
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} build_os)
41-
set(build_release "gnu")
45+
if(EXISTS "/etc/alpine-release")
46+
set(build_release "musl")
47+
else()
48+
set(build_release "gnu")
49+
endif()
4250
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
4351
set(build_os "w64")
4452
set(build_release "mingw32")

0 commit comments

Comments
 (0)