Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new github action build-push-action for docker development #331

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mirceachira
Copy link

What does it fix?

Closes #270

I added a build and publish workflow that triggers on pushes to master or develop. These will occur when pushing directly or when merging a pull request. Note that it won't occur if a pr is only created.
It will always push with the 'latest' tag

You will need to setup the following credentials as github secrets (similar to the example given):
ORGANIZATION - dockerhub organization
REPO - dockerhub image repository from the above organization (not sure if a new one needs to be created?)
USERNAME and PASSWORD for a user with access to these

You can find more information about the github action here: https://github.com/docker/build-push-action

How has it been tested?

I used a private github repo for testing the secrets setup along side a private dockerhub repository.

There's an issue I encountered, however. This fails though I'm not sure why yet.. I'm not familiar with dotnet but I believe it may be due to invalid credentials setup?

RUN dotnet publish -c Release -o ./out

Results in this during the publish step, when building the image:

... executor failed running [/bin/sh -c dotnet publish -c Release -o ./out]: exit code: 1

Because of (or without the files generated from) the previous error, the following occurs on this step:

COPY --from=build-env /app/api/VoteMonitor.Api/out/ .

Results in this during the publish step, when building the image:

... failed to compute cache key: "/app/api/VoteMonitor.Api/out" not found: not found

Copy link
Contributor

@RaduCStefanescu RaduCStefanescu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mirceachira
This one looks nice but what happens when you push to develop or master? The image will be built but based on two distinct code bases.
Can you please tag the image accordingly?
dev for develop branch, prod for master branch.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Devops] Add github action for uploading docker image to dockerhub on merge to develop / master
4 participants