Automated building and deployment process with Docker #2
2 changed files with 5 additions and 4 deletions
|
@ -10,8 +10,6 @@ COPY . .
|
||||||
# Install dependencies and build the site. Output directory will be /app/build
|
# Install dependencies and build the site. Output directory will be /app/build
|
||||||
RUN yarn install && yarn run build
|
RUN yarn install && yarn run build
|
||||||
|
|
||||||
# No need to move /app/build here
|
|
||||||
|
|
||||||
# Final stage
|
# Final stage
|
||||||
FROM caddy:2-alpine
|
FROM caddy:2-alpine
|
||||||
|
|
||||||
|
@ -29,3 +27,6 @@ EXPOSE 80
|
||||||
|
|
||||||
# Start Caddy with the specified Caddyfile
|
# Start Caddy with the specified Caddyfile
|
||||||
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
|
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
|
||||||
|
|
||||||
|
# Remove intermediate images after build
|
||||||
|
ONBUILD RUN rm -rf /app
|
||||||
|
|
4
Justfile
4
Justfile
|
@ -36,7 +36,7 @@ clean runner=default_runner tag=default_tag:
|
||||||
# clean images function
|
# clean images function
|
||||||
_clean_images runner=default_runner:
|
_clean_images runner=default_runner:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -o pipefail
|
||||||
image_ids=$({{runner}} image ls | grep gitpot.dev/sangelo/website | awk '{print $3}')
|
image_ids=$({{runner}} image ls | grep gitpot.dev/sangelo/website | awk '{print $3}')
|
||||||
if [ -n "$image_ids" ]; then
|
if [ -n "$image_ids" ]; then
|
||||||
for image_id in $image_ids; do
|
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 container image with specified runner (default runner: docker)
|
||||||
run tag=default_tag runner=default_runner:
|
run tag=default_tag runner=default_runner:
|
||||||
@echo "Running with '{{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
|
@# watch -n 1 {{runner}} compose -f docker-compose.build.yml ps
|
||||||
|
|
||||||
publish image=default_image runner=default_runner:
|
publish image=default_image runner=default_runner:
|
||||||
|
|
Loading…
Reference in a new issue