diff --git a/Dockerfile b/Dockerfile index 8296734..161e233 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/Justfile b/Justfile index 4334a5f..5291138 100644 --- a/Justfile +++ b/Justfile @@ -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: