build(docker): build with Docker Compose

This commit is contained in:
Oliver Davies 2022-01-26 08:50:06 +00:00
parent 3e97877c4c
commit a06b229755
2 changed files with 9 additions and 8 deletions

View file

@ -3,6 +3,7 @@ services:
build:
context: .
target: build
image: "ghcr.io/opdavies/oliverdavies.uk-web:${DOCKER_TAG:-latest}"
command: "sculpin generate --clean --port ${SCULPIN_PORT:-80} --url ${SCULPIN_URL:-http://localhost} --env ${SCULPIN_ENV:-dev} ${SCULPIN_GENERATE_ARGS}"
volumes:
- .:/app

16
run
View file

@ -2,8 +2,6 @@
set -eu
DOCKER_WEB_IMAGE_NAME="ghcr.io/opdavies/${COMPOSE_PROJECT_NAME:-oliverdavies.uk}-web"
TTY=""
if [[ ! -t 1 ]]; then
TTY="-T"
@ -12,15 +10,17 @@ fi
DC="${DC:-exec}"
function ci:build-images {
docker image build . \
--tag ${DOCKER_WEB_IMAGE_NAME}:${DOCKER_TAG} \
--tag ${DOCKER_WEB_IMAGE_NAME}:latest \
--target=production
services=(app)
DOCKER_TAG="$1" docker-compose build "${services[@]}"
DOCKER_TAG="latest" docker-compose build "${services[@]}"
}
function ci:push-images {
docker image push ${DOCKER_WEB_IMAGE_NAME}:${DOCKER_TAG}
docker image push ${DOCKER_WEB_IMAGE_NAME}:latest
services=(app)
DOCKER_TAG="$1" docker-compose push "${services[@]}"
DOCKER_TAG="latest" docker-compose push "${services[@]}"
}
function cmd {