-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from opencloud-eu/docker-builds
feat: script for docker builds
- Loading branch information
Showing
4 changed files
with
54 additions
and
11 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
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,27 @@ | ||
#!/bin/bash | ||
|
||
# Build the docker image for an application | ||
# Usage: ./build_docker.sh <app_name> <app_version> | ||
# Pre-requisites: App was built before and lies in `/apps/<app_name>`, see `build_app.sh` | ||
|
||
APP_NAME="$1" | ||
APP_VERSION="$2" | ||
|
||
if [ -z "$APP_NAME" ] || [ -z "$APP_VERSION" ]; then | ||
echo "Error: Please provide the app name and version" | ||
echo "Usage: ./build_docker.sh <app_name> <app_version>" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -d "./apps/$APP_NAME" ]; then | ||
echo "Error: App not found at ./apps/$APP_NAME" | ||
echo "Please build the app first using ./build_app.sh" | ||
echo "and make sure to run this script from the repository root" | ||
exit 1 | ||
fi | ||
|
||
docker buildx rm web-extensions-builder || true | ||
docker buildx create --name web-extensions-builder --platform linux/arm64,linux/amd64 | ||
docker buildx use web-extensions-builder | ||
docker buildx build --platform linux/arm64,linux/amd64 --output type=docker --file ./docker/Dockerfile --build-arg app_path=apps/$APP_NAME --build-arg app_name=$APP_NAME --tag opencloudeu/web-extensions:$APP_NAME-latest --tag opencloudeu/web-extensions:$APP_NAME-$APP_VERSION --tag quay.io/opencloudeu/web-extensions:$APP_NAME-latest --tag quay.io/opencloudeu/web-extensions:$APP_NAME-$APP_VERSION . | ||
docker buildx rm web-extensions-builder |
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 @@ | ||
#!/bin/bash | ||
|
||
# Push the docker images for an application | ||
# Usage: ./push_docker.sh <app_name> <app_version> | ||
# Pre-requisites: Docker images were built and tagged before, see `build_docker.sh` | ||
|
||
APP_NAME="$1" | ||
APP_VERSION="$2" | ||
|
||
if [ -z "$APP_NAME" ] || [ -z "$APP_VERSION" ]; then | ||
echo "Error: Please provide the app name and version" | ||
echo "Usage: ./push_docker.sh <app_name> <app_version>" | ||
exit 1 | ||
fi | ||
|
||
docker push opencloudeu/web-extensions:$APP_NAME-latest | ||
docker push opencloudeu/web-extensions:$APP_NAME-$APP_VERSION | ||
docker push quay.io/opencloudeu/web-extensions:$APP_NAME-latest | ||
docker push quay.io/opencloudeu/web-extensions:$APP_NAME-$APP_VERSION |
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 |
---|---|---|
@@ -1,28 +1,24 @@ | ||
FROM opencloud-eu/nginx@sha256:8ca0c90c2f537fef6195ba8f5ebe6d6c00fe0a0c545f25ce8acd418a831a19a4 | ||
FROM nginx@sha256:9d6b58feebd2dbd3c56ab5853333d627cc6e281011cfd6050fa4bcf2072c9496 | ||
|
||
LABEL maintainer="OpenCloud GmbH <info@opencloud.eu>" \ | ||
LABEL maintainer="OpenCloud GmbH <devops@opencloud.eu>" \ | ||
org.opencontainers.image.title="OpenCloud Web Extensions" \ | ||
org.opencontainers.image.description="OpenCloud Web Extensions" \ | ||
org.opencontainers.image.vendor="OpenCloud GmbH" \ | ||
org.opencontainers.image.authors="OpenCloud GmbH" \ | ||
org.opencontainers.image.licenses="AGPL-3.0" \ | ||
org.opencontainers.image.documentation="https://github.com/opencloud-eu/web-extensions" \ | ||
org.opencontainers.image.url="https://hub.docker.com/r/opencloud-eu/web-extensions" \ | ||
org.opencontainers.image.url="https://hub.docker.com/r/opencloudeu/web-extensions" \ | ||
org.opencontainers.image.source="https://github.com/opencloud-eu/web-extensions" | ||
|
||
ARG app_path | ||
ARG app_name | ||
|
||
RUN rm -f /var/lib/nginx/html/* | ||
RUN rm -f /usr/share/nginx/html/* | ||
|
||
ADD $app_path /var/lib/nginx/html/$app_name | ||
RUN find /var/lib/nginx/html | ||
|
||
EXPOSE 8080 | ||
|
||
USER nginx | ||
ADD $app_path /usr/share/nginx/html/$app_name | ||
RUN find /usr/share/nginx/html | ||
|
||
STOPSIGNAL SIGTERM | ||
|
||
CMD ["nginx", "-g", "daemon off;"] | ||
WORKDIR /var/lib/nginx/html | ||
WORKDIR /usr/share/nginx/html |