Skip to content

Commit

Permalink
Docker deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
jchv committed Jun 25, 2023
1 parent 44ce684 commit e5a56ec
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Docker

on:
push:
branches: [ master ]

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Docker Login
uses: azure/docker-login@v1
with:
login-server: docker.pkg.github.com
username: $GITHUB_ACTOR
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: docker build -t image .

- name: Publish
run: |
docker tag image docker.pkg.github.com/pangbox/server/minibox:${GITHUB_SHA}
docker push docker.pkg.github.com/pangbox/server/minibox:${GITHUB_SHA}
docker tag image docker.pkg.github.com/pangbox/server/minibox:latest
docker push docker.pkg.github.com/pangbox/server/minibox:latest
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM docker.io/golang:1.20.5-alpine AS builder
WORKDIR /src
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN go build -o /server ./cmd/minibox

FROM docker.io/alpine:latest
EXPOSE 8080/tcp 10101/tcp 20202/tcp 30303/tcp
USER 1000:1000
COPY --from=builder /server /server
WORKDIR /minibox
VOLUME /minibox
ENTRYPOINT ["/server", "-pangya_dir", "/pangya"]

0 comments on commit e5a56ec

Please sign in to comment.