Automated building and deployment process with Docker #2

Merged
sangelo merged 20 commits from docker into main 2024-04-03 12:10:51 +00:00
2 changed files with 5 additions and 4 deletions
Showing only changes of commit 6374398544 - Show all commits

View file

@ -10,8 +10,6 @@ COPY . .
# Install dependencies and build the site. Output directory will be /app/build
RUN yarn install && yarn run build
# No need to move /app/build here
# Final stage
FROM caddy:2-alpine
@ -29,3 +27,6 @@ EXPOSE 80
# Start Caddy with the specified Caddyfile
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
# Remove intermediate images after build
ONBUILD RUN rm -rf /app

View file

@ -36,7 +36,7 @@ clean runner=default_runner tag=default_tag:
# clean images function
_clean_images runner=default_runner:
#!/usr/bin/env bash
set -euo pipefail
set -o pipefail
image_ids=$({{runner}} image ls | grep gitpot.dev/sangelo/website | awk '{print $3}')
if [ -n "$image_ids" ]; then
for image_id in $image_ids; do
@ -55,7 +55,7 @@ build tag=default_tag runner=default_runner:
# run container image with specified runner (default runner: docker)
run tag=default_tag runner=default_runner:
@echo "Running with '{{runner}}'..."
{{runner}} compose -f docker-compose.build.yml up -d --force-recreate
TAG={{tag}} {{runner}} compose -f docker-compose.build.yml up -d --force-recreate
@# watch -n 1 {{runner}} compose -f docker-compose.build.yml ps
publish image=default_image runner=default_runner: