Skip to content

Commit dc8fc8d

Browse files
refactor (docker.yml): error handling
Remove build.sh as well
1 parent 306f690 commit dc8fc8d

File tree

2 files changed

+33
-52
lines changed

2 files changed

+33
-52
lines changed

bin/build.sh

Lines changed: 0 additions & 45 deletions
This file was deleted.

taskfiles/docker.yml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,59 @@ set: ['e', 'u', 'pipefail']
44
shopt: ['globstar']
55

66
env:
7-
BUILD: "{{.TLD}}/bin/build.sh"
87
COMPOSE_FILE: "{{.TLD}}/docker-compose.yml"
98
DOCKERFILE: "{{.TLD}}/Dockerfile.web"
10-
PLATFORM: "linux/amd64"
9+
PLATFORM:
10+
sh: "echo ${PLATFORM:-linux/amd64}"
11+
REGISTRY:
12+
sh: "echo ${REGISTRY:-ghcr.io}"
13+
USER_NAME:
14+
sh: "echo ${USER_NAME:-pythoninthegrass}"
15+
SERVICE: "meetup_bot"
16+
VERSION:
17+
sh: "echo ${VERSION:-latest}"
1118

1219
tasks:
1320
net:
1421
desc: "Create docker network"
1522
cmds:
1623
- |
1724
docker network create \
18-
--driver bridge \
19-
app-tier
25+
--driver bridge \
26+
app-tier
27+
status:
28+
- |
29+
docker network ls --format \{\{.Name\}\} \
30+
| grep -q '^app-tier$'
2031
2132
vol:
2233
desc: "Create docker volume"
2334
cmds:
2435
- |
2536
docker volume create \
26-
--driver local \
27-
mvp-vol
37+
--driver local \
38+
{{.SERVICE}}-vol
39+
status:
40+
- |
41+
docker volume ls --format \{\{.Name\}\} \
42+
| grep -q '^{{.SERVICE}}-vol$'
2843
2944
build:
3045
desc: "Build the docker image"
46+
summary: |
47+
Build the docker image with the specified dockerfile.
48+
49+
The default dockerfile is Dockerfile.web.
50+
51+
USAGE
52+
task docker:build
3153
cmds:
3254
- |
33-
{{.BUILD}} build {{.DOCKERFILE}} {{.SERVICE}}
55+
docker build \
56+
-f {{.DOCKERFILE}} \
57+
-t {{.SERVICE}} \
58+
--platform {{.PLATFORM}} \
59+
.
3460
3561
login:
3662
desc: "Login to the container registry"

0 commit comments

Comments
 (0)