Skip to content

Commit a1255de

Browse files
build: add login task
- Update env vars - Fix tld - Add login task for container registry
1 parent 23f5c34 commit a1255de

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

app/.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ PRIV_KEY_B64=base64_encoded_private_pem_key
2929
PUB_KEY_B64=base64_encoded_public_pem_key
3030
PY_VER=3.11.6
3131
REDIRECT_URI=https://acme.com
32-
REGISTRY_URL=registry.heroku.com/${HEROKU_APP}/web
32+
REGISTRY_URL=docker.io
33+
REGISTRY_PASS=containerregistrytoken
3334
RUN_TIME=1400
3435
SECRET_KEY=secretmeetinginthebasementofmybrain
3536
SELF_ID=techlahomauserid
37+
SERVICE=meetup-bot
3638
SIGNING_KEY_ID=activejwtkeyid
3739
SIGNING_SECRET=33characterstringthatImm1micking!
3840
SLACK_WEBHOOK=incomingwebhook
@@ -44,4 +46,5 @@ TTL=3600
4446
TZ=America/Chicago
4547
URL=https://dyno-name.herokuapp.com
4648
URLNAME=Techlahoma-Foundation
49+
USER_NAME=containerregistryusername
4750
USER_TOKEN=xoxp-usertoken

taskfile.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ dotenv: ['./app/.env']
77

88
env:
99
TLD:
10-
sh: "echo {{.TASKFILE_DIR}}" # absolute path
11-
# sh: "basename ${{.TASKFILE_DIR}}" # directory name
10+
sh: git rev-parse --show-toplevel
1211
APP:
1312
sh: echo "${APP_NAME:-meetup_bot}"
1413
POETRY:

tasks/docker.yml

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

66
env:
7-
BUILD: "{{.TASKFILE_DIR}}/bin/build.sh"
7+
BUILD: "{{.TLD}}/bin/build.sh"
88
COMPOSE_FILE: "{{.TLD}}/docker-compose.yml"
99
DOCKERFILE: "{{.TLD}}/Dockerfile.web"
1010
PLATFORM: "linux/amd64"
1111

1212
tasks:
13-
# TODO: list only the current taskfile tasks from parent taskfile
14-
default:
15-
desc: "Default task"
16-
cmds:
17-
- task --list
18-
1913
net:
2014
desc: "Create docker network"
2115
cmds:
@@ -38,9 +32,20 @@ tasks:
3832
- |
3933
{{.BUILD}} build {{.DOCKERFILE}} {{.SERVICE}}
4034
35+
login:
36+
desc: "Login to the container registry"
37+
cmds:
38+
- |
39+
echo "{{.REGISTRY_PASS}}" | docker login \
40+
-u {{.USER_NAME}} \
41+
--password-stdin {{.REGISTRY_URL}}
42+
run: once
43+
silent: true
44+
4145
push:
4246
desc: "Push the docker image to the registry"
4347
deps:
48+
- login
4449
- build
4550
cmds:
4651
- docker push {{.REGISTRY_URL}}/{{.USER_NAME}}/{{.SERVICE}}

0 commit comments

Comments
 (0)