+ Build Script

+ DockerFile
+ Docker-Compose Example
This commit is contained in:
Daniel Legt 2022-05-21 16:45:56 +03:00
parent b3220abdad
commit b74836e779
5 changed files with 64 additions and 1 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@ dev/*
.env .env
docker-compose.yaml docker-compose.yaml
data data
dist/*
!dist/.keep

15
Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM alpine
LABEL version="1.0.0"
# Copy the distribution files
COPY ./dist /app
# Make /app the work directory
WORKDIR /app
# Expose the listening port
EXPOSE 8080
# Run the program
ENTRYPOINT ["./freepad"]

18
build.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
echo "Building FreePad...\n";
echo "Removing old build file...";
rm dist/freepad 2> /dev/null || true
rm -r dist/static 2> /dev/null || true
rm -r dist/templates 2> /dev/null || true
rm dist/.env 2> /dev/null || true
# Build
echo "Building executable"
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o ./dist/freepad .
echo "Copying templates"
cp -r ./templates ./dist/templates
cp -r ./static ./dist/static
echo "Building Done";

0
dist/.keep vendored Normal file
View File

View File

@ -0,0 +1,28 @@
version: '3'
services:
freepad:
# Uncomment the bellow to use the production docker image from the docker repository
# image:
# Comment the build line if you are just looking to use a docker-compose file
build: .
# I don't recommend changing the 8080 as there would be no reason to,
# simply change the 3113 port to anything you would like for the container to listen on
ports:
- 3113:8080
# This will read from your .env variables, in that file you will find the documentation as well
environment:
- DOMAIN_BASE
- CACHE_MAP_LIMIT
- PAD_STORAGE_PATH
- API_BAN_LIMIT
- DEV_MODE
- CLEANUP_MAX_AGE
- MAXIMUM_PAD_SIZE
- 'GIN_MODE=release'
# This is the default data storage directory,
# you can mount this to ram, another server,
# locally, anything really it's just going to
# write plain files into it.
volumes:
- ./data:/app/data