Skip to content

Commit

Permalink
Passar senha do banco via parametro
Browse files Browse the repository at this point in the history
  • Loading branch information
fosouzadev committed Nov 16, 2024
1 parent 61bc37a commit 77e6332
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/github-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ jobs:
- name: Log in to GitHub Container Registry
run: echo ${{ secrets.PAT_DOCKER_IMAGES }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin

#- name: Set environment variable
# run: echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> $GITHUB_ENV

- name: Build docker image
run: make build
run: make build DB_PASSWORD=${{ secrets.DB_PASSWORD }}

- name: Publish docker image
run: make publish
4 changes: 3 additions & 1 deletion dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM postgres:17.0

ARG DB_PASSWORD

ENV POSTGRES_USER=admin
ENV POSTGRES_PASSWORD=Abc!1234
ENV POSTGRES_PASSWORD=${DB_PASSWORD}
ENV POSTGRES_DB=testdb

COPY sql /docker-entrypoint-initdb.d/
10 changes: 5 additions & 5 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
IMAGE_NAME=postgresql-container
IMAGE_NAME=ghcr.io/fosouzadev/postgresql-container
TAG=1.0

build:
docker build . -t ghcr.io/fosouzadev/$(IMAGE_NAME):$(TAG)
docker build . -t ghcr.io/fosouzadev/$(IMAGE_NAME):latest
docker build --build-arg DB_PASSWORD=$(DB_PASSWORD) . -t $(IMAGE_NAME):$(TAG)
docker build --build-arg DB_PASSWORD=$(DB_PASSWORD) . -t $(IMAGE_NAME):latest

publish:
docker push ghcr.io/fosouzadev/$(IMAGE_NAME):$(TAG)
docker push ghcr.io/fosouzadev/$(IMAGE_NAME):latest
docker push $(IMAGE_NAME):$(TAG)
docker push $(IMAGE_NAME):latest

0 comments on commit 77e6332

Please sign in to comment.