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: build:
context: . context: .
target: build 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}" command: "sculpin generate --clean --port ${SCULPIN_PORT:-80} --url ${SCULPIN_URL:-http://localhost} --env ${SCULPIN_ENV:-dev} ${SCULPIN_GENERATE_ARGS}"
volumes: volumes:
- .:/app - .:/app

16
run
View file

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