Skip to content

Commit

Permalink
Merge pull request #2 from JustKato/docker
Browse files Browse the repository at this point in the history
Dockerized!
  • Loading branch information
JustKato authored May 21, 2022
2 parents b3220ab + b74836e commit 73b3286
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ dev/*
!dev/.keep
.env
docker-compose.yaml
data
data
dist/*
!dist/.keep
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 changes: 18 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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";
Empty file added dist/.keep
Empty file.
28 changes: 28 additions & 0 deletions docker-compose.example.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 73b3286

Please sign in to comment.