-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #7
- Loading branch information
Showing
6 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Test Build-Env Docker Image | ||
|
||
on: | ||
pull_request: | ||
branches: master | ||
paths: | ||
- '**Dockerfile' | ||
- '**docker.yml' | ||
|
||
jobs: | ||
build-test-env-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build image | ||
run: docker build -t test-image -f docker/Dockerfile . | ||
|
||
- name: Build Docker image | ||
run: docker build -t test-image -f docker/Dockerfile ./docker | ||
|
||
- name: Run commands in Docker container | ||
run: | | ||
docker run --rm -v ${{ github.workspace }}:/workspace \ | ||
-w /workspace \ | ||
-u builder \ | ||
test-image \ | ||
/bin/bash -l -c "sudo mkdir /workspace/build && sudo chmod 777 /workspace/build && | ||
bun install && | ||
bun run codegen && | ||
bun run meson-setup.clang-release && | ||
meson compile -C build/ vs:executable | ||
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Build-Env Docker Image | ||
|
||
on: | ||
push: | ||
branches: master | ||
paths: | ||
- '**Dockerfile' | ||
- '**docker.yml' | ||
# workflow_dispatch: | ||
# schedule: | ||
# - cron: '30 11 20 */3 *' | ||
|
||
env: | ||
REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/vs-fltk | ||
|
||
jobs: | ||
build-env-image: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push by digest | ||
id: build | ||
uses: docker/build-push-action@v6 | ||
with: | ||
file: ./Dockerfile | ||
platforms: ${{ matrix.platform }} | ||
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:build-env-buildcache | ||
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:build-env-buildcache,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FROM debian:trixie-slim | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
ENV DEBIAN_FRONTEND=$DEBIAN_FRONTEND | ||
|
||
RUN \ | ||
apt update && apt upgrade -y && \ | ||
apt install -y \ | ||
build-essential \ | ||
ca-certificates \ | ||
clang-19 \ | ||
cmake \ | ||
curl \ | ||
freeglut3-dev \ | ||
git \ | ||
libpng-dev \ | ||
libsqlite3-0 \ | ||
libsqlitecpp-dev \ | ||
libtcc-dev \ | ||
lsb-release \ | ||
meson \ | ||
pkg-config \ | ||
sudo \ | ||
swiftlang \ | ||
unzip \ | ||
wget && \ | ||
update-ca-certificates -f | ||
|
||
RUN useradd -m builder && passwd -d builder | ||
RUN echo "builder ALL=(ALL) ALL" >> /etc/sudoers | ||
WORKDIR /home/builder | ||
USER builder | ||
|
||
RUN curl -fsSL https://bun.sh/install | bash | ||
RUN \ | ||
echo "export BUN_INSTALL=\"\$HOME/.bun\"" >> $HOME/.profile && \ | ||
echo "export PATH=\"\$BUN_INSTALL/bin:\$PATH\"" >> $HOME/.profile | ||
|
||
USER root | ||
CMD ["bash", "-l"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Docker | ||
|
||
## Using docker-compose | ||
|
||
You may build and test your changes by using the compose file: | ||
|
||
docker-compose -f ./docker/docker-compose.yml up | ||
|
||
## Entering the build environment | ||
|
||
While in the repository root, to enter the environment and be presented with a | ||
shell: | ||
|
||
docker run -it --rm -u builder \ | ||
-v $PWD:/workspace ghcr.io/KaruroChori/vs-fltk:build-env | ||
|
||
This will mount your current directory as */workspace* inside the container. | ||
Your username will be *builder*. By default, you will not have root privileges | ||
(which are not necessary to build and test). However, you can use `sudo` if | ||
you need to run `apt` or any other commands that require root access. | ||
|
||
## Getting the image | ||
|
||
You can pull the image manually: | ||
|
||
docker pull ghcr.io/KaruroChori/vs-fltk:build-env | ||
|
||
If you use `docker-compose` or `docker run ...` the image will be pulled | ||
automatically the first time. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: '3.8' | ||
|
||
services: | ||
dev: | ||
image: ghcr.io/KaruroChori/vs-fltk:build-env | ||
container_name: vs-fltk-env | ||
volumes: | ||
- ${PWD}:/workspace | ||
working_dir: /workspace | ||
user: builder | ||
command: > | ||
bash -l -c " | ||
bun install && | ||
bun run codegen && | ||
bun run meson-setup.clang-release && | ||
meson compile -C build/ vs:executable | ||
" | ||
stdin_open: true # Allows interactive mode | ||
tty: true # Allocate a pseudo-TTY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters