forked from linux-do/override
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
18 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,44 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- master # Replace with your branch name if different | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to Docker Hub | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | ||
|
||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: cursor1st/override | ||
tags: | | ||
type=ref,event=tag | ||
type=semver,pattern={{version}} | ||
type=raw,value=latest | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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,17 +1,22 @@ | ||
FROM golang:alpine AS builder | ||
|
||
WORKDIR /app | ||
COPY . . | ||
|
||
ADD . . | ||
ENV GO111MODULE=on | ||
RUN go mod download | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o override | ||
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o override | ||
|
||
FROM alpine:latest | ||
|
||
COPY --from=builder /app/override /usr/local/bin/override | ||
RUN apk --no-cache add ca-certificates | ||
|
||
WORKDIR /app | ||
COPY --from=builder /app/override /usr/local/bin/ | ||
COPY config.json.example /app/config.json | ||
|
||
ENTRYPOINT ["/usr/local/bin/override"] | ||
WORKDIR /app | ||
VOLUME /app | ||
|
||
EXPOSE 8181 | ||
EXPOSE 8080 | ||
CMD ["override"] |
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
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,12 +1,9 @@ | ||
name: override | ||
services: | ||
override-app: | ||
image: linux-do/override:latest | ||
container_name: override-app | ||
restart: always | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
volumes: | ||
- ./config.json:/app/config.json | ||
ports: | ||
- "8181:8181" | ||
override: | ||
container_name: override | ||
ports: | ||
- 8080:8080 | ||
volumes: | ||
- /root/docker/override:/app | ||
image: cursor1st/override:latest |