forked from entrepreneur-interet-general/opensignauxfaibles
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - action pour build et push le conteneur * - local_data * Changes by raphaelsquelbut * fix workflow * fix workflow / go build * try broken binary name (test) * fix broken binary name (test) * newer method to set chmod sfdata * full path for binary in Dockerfile * add go generate to container build * npm install before go generate Co-authored-by: Christophe Ninucci <[email protected]>
- Loading branch information
Showing
10 changed files
with
4,654 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Build & Push Container vers ghcr.io | ||
|
||
on: | ||
push: | ||
branches: | ||
release: | ||
types: [published, edited] | ||
pull_request: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
container_datapi: | ||
name: Push OpenSignauxFaibles container | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 12 | ||
|
||
- name: Set up Go 1.14 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.14 | ||
id: go | ||
|
||
- name: Prepare js sources | ||
run: npm install --prefer-offline --no-audit | ||
working-directory: js | ||
|
||
- name: Prepare container sources & resources | ||
shell: bash | ||
run: | | ||
go generate -x ./... | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o sfdata | ||
cp ./sfdata ./build-container | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=tag | ||
type=ref,event=pr | ||
flavor: | | ||
latest=true | ||
- name: Login to GitHub Container Registry | ||
id: login | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./build-container | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
FROM alpine:3.12 | ||
COPY ./$path/sfdata /app | ||
RUN chmod 555 /app/sfdata | ||
COPY --chmod=555 sfdata /app/sfdata | ||
WORKDIR /app | ||
EXPOSE 3000 | ||
CMD ["/app/sfdata"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.