👷 Docker support #19
4 changed files with 127 additions and 0 deletions
32
.woodpecker/build.yaml
Normal file
32
.woodpecker/build.yaml
Normal file
|
@ -0,0 +1,32 @@
|
|||
steps:
|
||||
- name: publish_image
|
||||
image: woodpeckerci/plugin-docker-buildx
|
||||
settings:
|
||||
repo: git.gnous.eu/${CI_REPO_OWNER}/plakken
|
||||
dockerfile: docker/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64/v8,linux/arm
|
||||
registry: https://git.gnous.eu
|
||||
tag: ${CI_COMMIT}
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
when:
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push
|
||||
- name: publish_image_tag
|
||||
image: woodpeckerci/plugin-docker-buildx
|
||||
settings:
|
||||
repo: git.gnous.eu/${CI_REPO_OWNER}/plakken
|
||||
dockerfile: docker/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64/v8,linux/arm
|
||||
registry: https://git.gnous.eu
|
||||
tags:
|
||||
- ${CI_COMMIT_TAG##v} # Remove v from tag
|
||||
- stable
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
when:
|
||||
event: tag
|
28
docker/Dockerfile
Normal file
28
docker/Dockerfile
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Build
|
||||
FROM golang:1.22 AS build
|
||||
LABEL authors="gnousEU"
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY main.go ./
|
||||
COPY internal/ ./internal
|
||||
COPY static/ ./static
|
||||
COPY templates/ ./templates
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-w -s" # Enable static binary, target Linux, remove debug information and strip binary
|
||||
|
||||
# Copy to our image
|
||||
FROM gcr.io/distroless/static-debian12:nonroot
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /build/plakken ./
|
||||
|
||||
ENV PLAKKEN_LISTEN ":3000"
|
||||
|
||||
EXPOSE 3000/tcp
|
||||
|
||||
ENTRYPOINT ["/app/plakken"]
|
31
docker/docker-compose.dev.yaml
Normal file
31
docker/docker-compose.dev.yaml
Normal file
|
@ -0,0 +1,31 @@
|
|||
version: "3"
|
||||
|
||||
networks:
|
||||
plakken:
|
||||
external: false
|
||||
|
||||
services:
|
||||
server:
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: docker/Dockerfile
|
||||
restart: always
|
||||
container_name: plakken
|
||||
networks:
|
||||
- plakken
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- PLAKKEN_REDIS_ADDRESS=redis:6379
|
||||
- POSTGRES_PASSWORD=gitea
|
||||
- PLAKKEN_REDIS_DB=0
|
||||
- PLAKKEN_URL_LENGTH=5
|
||||
depends_on:
|
||||
- redis
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
restart: always
|
||||
healthcheck:
|
||||
test: [ "CMD", "redis-cli", "ping" ]
|
||||
networks:
|
||||
- plakken
|
36
docker/docker-compose.yaml
Normal file
36
docker/docker-compose.yaml
Normal file
|
@ -0,0 +1,36 @@
|
|||
version: "3"
|
||||
|
||||
networks:
|
||||
plakken:
|
||||
external: false
|
||||
|
||||
volumes:
|
||||
redis:
|
||||
driver: local
|
||||
|
||||
services:
|
||||
server:
|
||||
image: git.gnous.eu/gnouseu/plakken:latest
|
||||
restart: always
|
||||
container_name: plakken
|
||||
read_only: true
|
||||
networks:
|
||||
- plakken
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- PLAKKEN_REDIS_ADDRESS=redis:6379
|
||||
- POSTGRES_PASSWORD=gitea
|
||||
- PLAKKEN_REDIS_DB=0
|
||||
- PLAKKEN_URL_LENGTH=5
|
||||
depends_on:
|
||||
- redis
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
restart: always
|
||||
healthcheck:
|
||||
test: [ "CMD", "redis-cli", "ping" ]
|
||||
networks:
|
||||
- plakken
|
||||
volumes:
|
||||
- redis:/data
|
Loading…
Reference in a new issue