-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
710ffbf
commit 4f69560
Showing
8 changed files
with
162 additions
and
32 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,29 @@ | ||
name: Release docker image with latest proxy server | ||
|
||
on: | ||
release: | ||
types: | ||
- released | ||
tags: | ||
- '*' | ||
|
||
|
||
env: | ||
TAG: ${{ github.event.release.tag_name }} | ||
DOCKER_HUB_ID: ${{ secrets.DOCKER_HUB_ID }} | ||
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
|
||
jobs: | ||
docker: | ||
name: Publish docker image | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ env.DOCKER_HUB_ID }} | ||
password: ${{ env.DOCKER_HUB_PASSWORD }} | ||
- run: make build | ||
- run: make publish |
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 @@ | ||
.idea |
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,7 @@ | ||
.PHONY: build | ||
build: | ||
@docker build --target server -t brushknight/terrarium-proxy:latest -f server/Dockerfile server | ||
|
||
.PHONY: publish | ||
publish: | ||
@docker push brushknight/terrarium-proxy:latest |
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
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Dockerfile References: https://docs.docker.com/engine/reference/builder/ | ||
|
||
### Build binary | ||
|
||
# Start from the latest golang base image | ||
FROM golang:latest AS builder | ||
|
||
# Add Maintainer Info | ||
LABEL maintainer="Grigorii Merkushev <[email protected]>" | ||
|
||
# Set the Current Working Directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy go mod and sum files | ||
COPY go.mod go.sum ./ | ||
|
||
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed | ||
RUN go mod download | ||
|
||
# Copy the source from the current directory to the Working Directory inside the container | ||
COPY server.go . | ||
|
||
# Build the Go apps | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o server server.go | ||
|
||
### | ||
### Create image with binary | ||
### | ||
|
||
# Start from the latest alpine base image | ||
FROM alpine:latest AS server | ||
|
||
# Set the Current Working Directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy zoneinfo | ||
RUN apk --no-cache add tzdata | ||
|
||
# Copy artifacts created in previous step | ||
COPY --from=builder /app/server . | ||
|
||
# Add executable permissions | ||
RUN chmod +x ./server | ||
|
||
# Command to run the executable | ||
ENTRYPOINT ["./server"] | ||
|
||
# Expose port 80 to the outside world | ||
EXPOSE 80 | ||
|
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