Skip to content

Commit

Permalink
build: test user in dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
vladkens committed Aug 17, 2024
1 parent 59156c1 commit a4ceef0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ jobs:
- uses: docker/setup-buildx-action@v3

- name: Login to ghcr.io
if: ${{ github.ref == 'refs/heads/main' }} || ${{ startsWith(github.ref, 'refs/tags/v') }}
if: ${{ github.ref == 'refs/heads/test' }} || ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build & push (main)
if: ${{ github.ref == 'refs/heads/main' }}
if: ${{ github.ref == 'refs/heads/test' }}
uses: docker/build-push-action@v6
with:
push: true
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
ghcr.io/${{ github.repository }}:main
ghcr.io/${{ github.repository }}:test
- name: build & push (tag)
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ LABEL org.opencontainers.image.source="https://github.com/vladkens/ghstats"

WORKDIR /app
COPY --from=builder /app/target/release/ghstats .
RUN addgroup -g 1000 -S app && adduser -u 1000 -S app -G app && chown -R app:app /app

USER app
ENV HOST=0.0.0.0
ENV PORT=8080
EXPOSE 8080
Expand Down

0 comments on commit a4ceef0

Please sign in to comment.