Skip to content

Commit e910645

Browse files
committed
Add Dockerfiles
1 parent 99630d7 commit e910645

File tree

4 files changed

+78
-5
lines changed

4 files changed

+78
-5
lines changed

.goreleaser.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
project_name: funnel-plugins
2+
13
builds:
2-
- binary: funnel-plugins
4+
- binary: auth-plugin
35
goos:
46
- darwin
57
- linux
@@ -22,7 +24,3 @@ release:
2224

2325
env_files:
2426
github_token: .github_token
25-
26-
archives:
27-
- format: tar.gz
28-
name_template: "{{.ProjectName}}-{{.Os}}-{{.Arch}}-{{.Version}}"

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Use the official Golang image as the base image
2+
FROM golang:1.23-alpine
3+
4+
# Set the Current Working Directory inside the container
5+
WORKDIR /app
6+
7+
# Copy the go.mod and go.sum files
8+
COPY go.mod go.sum ./
9+
10+
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
11+
RUN go mod download
12+
13+
# Copy the source code into the container
14+
COPY . .
15+
16+
RUN mkdir -p ./build/plugins
17+
18+
# Build the Go app (CLI)
19+
# Helpful for testing + debugging
20+
RUN go build -o ./build/cli .
21+
22+
# Build the plugin
23+
RUN go build -o ./build/plugins/authorizer ./plugin

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
git_commit := $(shell git rev-parse --short HEAD)
2+
git_branch := $(shell git symbolic-ref -q --short HEAD)
3+
git_upstream := $(shell git remote get-url $(shell git config branch.$(shell git symbolic-ref -q --short HEAD).remote) 2> /dev/null)
4+
export GIT_BRANCH = $(git_branch)
5+
export GIT_UPSTREAM = $(git_upstream)
6+
7+
VERSION_LDFLAGS=\
8+
-X "github.com/ohsu-comp-bio/funnel/version.BuildDate=$(shell date)" \
9+
-X "github.com/ohsu-comp-bio/funnel/version.GitCommit= $(git_commit)" \
10+
-X "github.com/ohsu-comp-bio/funnel/version.GitBranch=$(git_branch)" \
11+
-X "github.com/ohsu-comp-bio/funnel/version.GitUpstream=$(git_upstream)"
12+
113
DIR = build
214

315
.PHONY: all build clean tests
@@ -17,3 +29,18 @@ build:
1729
tests:
1830
# Build test server
1931
go build -o $(DIR)/test-server ./tests/test-server.go
32+
33+
# Build binaries for all OS/Architectures
34+
snapshot: release-dep
35+
@goreleaser \
36+
--clean \
37+
--snapshot
38+
39+
# Create a release on Github using GoReleaser
40+
release:
41+
@goreleaser --clean
42+
43+
# Install dependencies for release
44+
release-dep:
45+
@go get github.com/goreleaser/goreleaser
46+
@go get github.com/buchanae/github-release-notes

tests/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use the official Golang image as the base image
2+
FROM golang:1.23-alpine
3+
4+
# Set the Current Working Directory inside the container
5+
WORKDIR /app
6+
7+
# Copy the go.mod and go.sum files
8+
COPY go.mod go.sum ./
9+
10+
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
11+
RUN go mod download
12+
13+
# Copy the source code into the container
14+
COPY . .
15+
16+
RUN mkdir -p ./build
17+
18+
# Build the Go app (CLI)
19+
RUN go build -o ./build/test-server .
20+
21+
# Expose port 8080 to the outside world
22+
EXPOSE 8080
23+
24+
# Command to run the executable
25+
CMD ["./build/cli"]

0 commit comments

Comments
 (0)