1
0
mirror of https://github.com/JustKato/FreePad.git synced 2026-03-20 02:59:46 +02:00

4 Commits

Author SHA1 Message Date
662dad90b7 Merge pull request #13 from JustKato/feature/dockerFileBuild
Dockerfile Build Improvements
2022-06-01 21:30:04 +03:00
1585d3b158 * Replaced alpine with Scratch
* Changed comments
* Used /src instead of /app twice
2022-06-01 21:28:57 +03:00
1d50efe3c6 Dockerfile Build Improvements 2022-06-01 21:24:03 +03:00
0f5a352fc6 * Docker Compose example updated 2022-06-01 18:43:35 +03:00
2 changed files with 24 additions and 6 deletions

View File

@@ -1,9 +1,27 @@
FROM alpine
# Importing golang 1.18 to use as a builder for our source
FROM golang:1.18 as builder
# Use the /src directory as a workdir
WORKDIR /src
# Copy the src to /src
COPY . ./
# Download dependencies
RUN go mod download
# Build the executable
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o freepad .
# Import alpine linux as a base
FROM scratch
LABEL version="1.4.0"
# Copy the distribution files
COPY ./dist /app
# Copy the files from the builder to the new image
COPY --from=builder /src/freepad /app/freepad
COPY --from=builder /src/templates /app/templates
COPY --from=builder /src/static /app/static
# Make /app the work directory
WORKDIR /app

View File

@@ -3,13 +3,13 @@ version: '3'
services:
freepad:
# Uncomment the bellow to use the production docker image from the docker repository
# image:
image: justkato/freepad
# Comment the build line if you are just looking to use a docker-compose file
build: .
# 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
- 8080:8080
# This will read from your .env variables, in that file you will find the documentation as well
environment:
- DOMAIN_BASE