Adds a docker image and build task for said image

This commit is contained in:
zontreck 2025-03-15 00:18:27 -07:00
parent 37ba232a54
commit d87c0192ac
6 changed files with 110 additions and 2 deletions

40
Dockerfile Normal file
View file

@ -0,0 +1,40 @@
FROM git.zontreck.com/packages/flutter:latest as BUILDER
WORKDIR /app
COPY ./pubspec.yaml ./
COPY ./cli ./
COPY ./lib ./
COPY ./android ./
COPY ./linux ./
COPY ./ios ./
COPY ./macos ./
COPY ./test ./
COPY ./web ./
COPY ./windows ./
COPY ./analysis_options.yaml ./
RUN dart pub get
RUN dart fix --apply
RUN dart compile exe -o bugvaultd cli/server.dart
FROM git.zontreck.com/packages/flutter:latest
LABEL author Tara Piccari
LABEL email tarapiccari@gmail.com
ENV BUGVAULT_DATA_DIRECTORY /data
COPY --from=BUILDER /app/bugvaultd /sbin/bugvaultd
SHELL ["/bin/bash", "-c"]
COPY ./docker-entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
WORKDIR /data
RUN useradd -s /bin/bash -d /data -M bugvault
USER bugvault:bugvault
ENTRYPOINT [ "/entrypoint.sh" ]

54
Jenkinsfile vendored
View file

@ -130,5 +130,59 @@ pipeline {
}
}
}
stage("Build Server") {
agent {
label 'linux'
}
steps {
script {
sh '''
#!/bin/bash
dart pub get
mkdir out
dart compile exe -o out/server cli/server.dart
mv out/server bugvaultd
'''
}
}
post {
always {
archiveArtifacts artifacts: "bugvaultd"
cleanWs()
}
}
}
stage("Build Docker") {
agent {
label 'dockermain'
}
steps {
script {
sh '''
#!/bin/bash
docker build -t git.zontreck.com/packages/bugvault:latest "$(pwd)"
docker push git.zontreck.com/packages/bugvault:latest
docker rmi -f git.zontreck.com/packages/bugvault:latest
docker buildx prune -a -f
'''
}
}
post {
always {
cleanWs()
}
}
}
}
}

9
cli/server.dart Normal file
View file

@ -0,0 +1,9 @@
Future<int> main(List<String> args) async {
print("Starting BugVault Server...");
// Check for settings.dat, which should contain all basic information.
// Then check if any data exists. If not, create data hierarchy
print("Thank you for choosing BugVault! - Shutting down...");
return 0;
}

4
docker-entrypoint.sh Normal file
View file

@ -0,0 +1,4 @@
#!/bin/bash
echo "Welcome to BugVault - Docker"
/sbin/bugvaultd

View file

@ -1,4 +1,4 @@
class Constants {
static const VERSION = "1.0.031425+2339";
static const VERSION = "1.0.031525+0003";
static const APP_NAME = "BugVault";
}

View file

@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.031425+2339
version: 1.0.031525+0003
environment:
sdk: ^3.7.0
@ -40,6 +40,7 @@ dependencies:
libac_dart:
hosted: https://git.zontreck.com/api/packages/Packages/pub/
version: 1.4.20325+1215
totp: ^0.1.0
dev_dependencies:
flutter_test: