Skip to content

Commit 2c7d09e

Browse files
Docker!
1 parent f3f1b73 commit 2c7d09e

File tree

5 files changed

+71
-1
lines changed

5 files changed

+71
-1
lines changed

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:1.23.0
2+
3+
WORKDIR /usr/src/app
4+
5+
COPY . .
6+
7+
RUN make
8+
9+
EXPOSE 3002
10+
11+
CMD ["./bin/assets-server"]

Makefile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
SHELL := bash
2+
.PHONY: build clean download run linux windows mac default
3+
.DEFAULT_GOAL := default
4+
5+
clean:
6+
@echo "Cleaning up..."
7+
@rm -rf build
8+
9+
download:
10+
@echo "Downloading dependencies..."
11+
@go get
12+
13+
run:
14+
@echo "Running..."
15+
@go run main.go
16+
17+
linux: download
18+
@echo "Building for Linux..."
19+
@GOOS=linux GOARCH=amd64 go build -o bin/assets-server -ldflags "-s -w" main.go
20+
@GOOS=linux GOARCH=arm go build -o bin/assets-server-arm -ldflags "-s -w" main.go
21+
@GOOS=linux GOARCH=arm64 go build -o bin/assets-server-arm64 -ldflags "-s -w" main.go
22+
@GOOS=linux GOARCH=386 go build -o bin/assets-server-386 -ldflags "-s -w" main.go
23+
24+
windows: download
25+
@echo "Building for Windows..."
26+
@GOOS=windows GOARCH=amd64 go build -o bin/assets-server.exe -ldflags "-s -w" main.go
27+
@GOOS=windows GOARCH=386 go build -o bin/assets-server-386.exe -ldflags "-s -w" main.go
28+
29+
mac: download
30+
@echo "Building for Mac..."
31+
@GOOS=darwin GOARCH=amd64 go build -o bin/assets-server-mac -ldflags "-s -w" main.go
32+
@GOOS=darwin GOARCH=arm64 go build -o bin/assets-server-mac-arm64 -ldflags "-s -w" main.go
33+
34+
default: clean download
35+
@echo "Building for current OS..."
36+
@go build -o bin/assets-server -ldflags "-s -w" main.go
37+
38+
format:
39+
@echo "Formatting..."
40+
@go fmt
41+
42+
all: clean download linux windows mac

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- I recommend using Docker for this so you don't have to build the server files!
1515
- A docker-compose.yml & Dockerfile are provided.
1616
- You can either use the prebuilt docker image (docker-compose.yml)
17-
- Or clone the repository and build yourself with docker (not recommended as the repo is huge)
17+
- Or clone the repository and build yourself with docker (docker-compose.build.yml)
1818

1919
### Using in your frontend
2020
This is super easy!

docker-compose.build.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: "3"
2+
3+
services:
4+
assets-server:
5+
image: assets-server:latest
6+
build:
7+
context: .
8+
dockerfile: Dockerfile
9+
ports:
10+
- 3002:3002

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: "3"
2+
3+
services:
4+
assets-server:
5+
image: ghcr.io/ruby-network/assets-server:latest
6+
ports:
7+
- 3002:3002

0 commit comments

Comments
 (0)