Skip to content

Cicd docker #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .cicd/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
README.md
1 change: 1 addition & 0 deletions .cicd/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
runenv.sh text eol=lf
3 changes: 3 additions & 0 deletions .cicd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/*
AtomicGameRoot/*
*.zip
Empty file added .cicd/AtomicGameRoot/.empty
Empty file.
Empty file added .cicd/build/.empty
Empty file.
17 changes: 17 additions & 0 deletions .cicd/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.4'

services:
atomic:
image: atomic
container_name: atomic
volumes:
- /d/Projekte/fpc_atomic/bomber/:/AtomicGameRoot:ro
- ${PWD}/build:/build
environment:
- ATOMIC_BUILD_WIN64=false
- ATOMIC_BUILD_WIN32=false
- ATOMIC_BUILD_LINUX=true
- ATOMIC_EXTRA_ANI=true
#tty: true
#stdin_open: true
#command: bash
22 changes: 22 additions & 0 deletions .cicd/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM wimmercg/lazarus-docker:1.1.0
#FROM lazarus-base

LABEL Name="FCP Source and Lazarus Git main, Linux64 and Win32, Win64 crosscompile with lazbuild"

RUN apt update && apt install subversion -y
RUN mkdir /build && mkdir -p /source && mkdir -p /temp

# FPC-Atomic GIT clone
RUN git clone https://github.com/PascalCorpsman/fpc_atomic.git /source/fpc_atomic
# Pre-Requisites for FPC-Atomic
RUN wget https://www.un4seen.com/files/bass24.zip && unzip -j bass24.zip x64/bass.dll -d /temp && unzip -j bass24.zip delphi/bass.pas -d /source/fpc_atomic
RUN mkdir -p /source/fpc_atomic/lib/x86_64-linux && wget https://www.un4seen.com/files/bass24-linux.zip && unzip -j bass24-linux.zip libs/x86_64/libbass.so -d /source/fpc_atomic/
RUN wget https://raw.githubusercontent.com/SaschaWillems/dglOpenGL/master/dglOpenGL.pas -O /source/fpc_atomic/dglOpenGL.pas && cp /source/fpc_atomic/dglOpenGL.pas /source/fpc_atomic/cd_data_extractor/

RUN mkdir -p /source/synapse && cd /source/synapse && svn checkout https://svn.code.sf.net/p/synalist/code/trunk . && mv /source/synapse/* /source/fpc_atomic/
RUN /install_corpsman_lnet.sh

COPY runenv.sh /runenv.sh
RUN chmod 777 /runenv.sh

CMD /runenv.sh
4 changes: 4 additions & 0 deletions .cicd/mountAtomicRoot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
#docker run -it -v /${PWD}/AtomicGameRoot:/AtomicGameRoot -v /${PWD}/build:/build atomic bash
#docker run -it -v //d/Projekte/fpc_atomic/bomber/:/AtomicGameRoot -v /${PWD}/build:/build atomic bash
docker-compose -f docker-compose.yml up
13 changes: 13 additions & 0 deletions .cicd/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "build",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"make": "docker build . -t atomic",
"run": "(docker container rm atomic || true) && docker run --name atomic atomic ",
"it": "docker run -it atomic /bin/bash",
"up": "docker compose up -d && docker exec -it cicd_atomic_1 bash ; docker compose down"
},
"author": ""
}
48 changes: 48 additions & 0 deletions .cicd/runenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
set -x

cd /source/fpc_atomic
git pull

rm -r /build/*
mkdir -p /build/DATA
cp /temp/bass.dll /build/

if [ "$ATOMIC_BUILD_LINUX" == "true" ]
then
cd /source/fpc_atomic/ && lazbuildl64 fpc_atomic.lpi && mv fpc_atomic /build
fi

if [ "$ATOMIC_BUILD_WIN64" == "true" ]
then
cd /source/fpc_atomic/ && lazbuildw64 fpc_atomic.lpi && mv fpc_atomic.exe /build
fi

if [ "$ATOMIC_BUILD_WIN32" == "true" ]
then
cd /source/fpc_atomic/ && lazbuildw32 fpc_atomic.lpi && mv fpc_atomic.exe /build/fpc_atomic32.exe
fi

if [ -z "$(ls -A /AtomicGameRoot)" ]
then
echo "/AtomicGameRoot is empty"
else
echo Found AtomicGameRoot DATA. Copying to build/DATA folder

cd /source/fpc_atomic/cd_data_extractor && lazbuildl64 cd_data_extractor_nogui.lpi && lazbuildw64 cd_data_extractor_nogui.lpi
# TODO: executing a CLI version of cd_data_extractor to convert data from /AtomicGameRoot/DATA/ to /build/DATA/

cp cd_data_extractor_nogui /build
cp cd_data_extractor_nogui.exe /build

# not working due to gtk error on linux
#./cd_data_extractor_nogui -cd /AtomicGameRoot -atomic /build
# cp -r /AtomicGameRoot/DATA/* /build/DATA/

if [ "$ATOMIC_EXTRA_ANI" == "true" ]
then
echo Download extra content
wget https://www.oocities.org/timessquare/tower/4056/download/ani.zip --no-check-certificate -O /temp/ani.zip && unzip -jo /temp/ani.zip -d /build/DATA/ANI
fi
fi