Commit e0c01938 authored by Manuel Herold's avatar Manuel Herold

added build files for automated build support

parent 9f51b022
...@@ -81,36 +81,27 @@ if __name__ == '__main__': ...@@ -81,36 +81,27 @@ if __name__ == '__main__':
with cd(path): with cd(path):
print(f"> flutter build web") print(f"> flutter build web")
os.system(f"flutter build web") os.system(f"flutter build web")
# copy Dockerfile into root dir to have access to modules folder
shutil.copy2(os.path.join(path, DOCKER_BUILD_NAME), ROOT)
print(f"> docker image build -t {image_name} {path}") # build then remove Dockerfile
exit_val = os.system(f"docker image build -t {image_name} {path}") exit_val = os.system(f"docker image build -t {image_name} {ROOT}")
os.remove(os.path.join(ROOT, DOCKER_BUILD_NAME))
if exit_val != 0: res_str.append(f"{image_name} built with exit code {exit_val}")
error = exit_val
else:
print(f"> docker push {image_name}")
exit_val = os.system(f"docker push {image_name}")
else:
# copy Dockerfile into root dir to have access to modules folder
shutil.copy2(os.path.join(path, DOCKER_BUILD_NAME), ROOT)
# build then remove Dockerfile if exit_val != 0:
exit_val = os.system(f"docker image build -t {image_name} {ROOT}") error = exit_val
os.remove(os.path.join(ROOT, DOCKER_BUILD_NAME))
res_str.append(f"{image_name} built with exit code {exit_val}") else:
# push created Docker image
exit_val = os.system(f"docker push {image_name}")
res_str.append(f"{image_name} pushed with exit code {exit_val}")
if exit_val != 0: if exit_val != 0:
error = exit_val error = exit_val
else:
# push created Docker image
exit_val = os.system(f"docker push {image_name}")
res_str.append(f"{image_name} pushed with exit code {exit_val}")
if exit_val != 0:
error = exit_val
print(f"Found {len(command_args)} images") print(f"Found {len(command_args)} images")
for s in res_str: for s in res_str:
print(s) print(s)
......
FROM nginx:latest FROM nginx:latest
EXPOSE 80 EXPOSE 443
COPY ./src/dashboard/deployment/nginx.conf /etc/nginx/conf.d/default.conf
COPY ./src/dashboard/build/web/ /usr/share/nginx/html/ COPY ./src/dashboard/build/web/ /usr/share/nginx/html/
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: dashboard
spec:
type: LoadBalancer
selector:
app: dashboard
ports:
- name: https
port: 443
targetPort: 443
nodePort: 30469
protocol: TCP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dashboard
spec:
replicas: 1
selector:
matchLabels:
app: dashboard
template:
metadata:
labels:
app: dashboard
spec:
containers:
- name: dashboard
image: alexx882/dashboard
ports:
- containerPort: 443
imagePullPolicy: Always
volumeMounts:
- mountPath: /certs
name: articonf
volumes:
- name: articonf
hostPath:
path: /srv/articonf
type: Directory
\ No newline at end of file
server {
listen 443 ssl;
server_name demo;
ssl_certificate /certs/articonf1.crt;
ssl_certificate_key /certs/articonf1.key;
location / {
root /usr/share/nginx/html;
try_files $uri /index.html;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment