Skip to content

Commit

Permalink
🐳 Add Docker Image
Browse files Browse the repository at this point in the history
  • Loading branch information
0x46616c6b committed Oct 3, 2024
1 parent c5d936b commit 896fe2f
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
USERLI_TOKEN=insecure
USERLI_BASE_URL=http://localhost:8000
ALIAS_LISTEN_ADDR=":10001"
DOMAIN_LISTEN_ADDR=":10002"
MAILBOX_LISTEN_ADDR=":10003"
SENDERS_LISTEN_ADDR=":10004"
METRICS_LISTEN_ADDR=":10005"

LOG_LEVEL=debug
LOG_FORMAT=text
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ updates:
directory: "/"
schedule:
interval: "monthly"

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
3 changes: 3 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ jobs:

- name: Build
run: go build

- name: Docker Build
run: docker build .
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM golang:1.23-alpine3.19 AS build

ENV USER=appuser
ENV UID=10001

RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"

WORKDIR /app

COPY go.mod go.sum ./

RUN go mod download && go mod verify

COPY . .

RUN go build -ldflags="-s -w" -o ./userli-postfix-adapter


FROM scratch AS runtime

COPY --from=build /app/userli-postfix-adapter /userli-postfix-adapter

COPY --from=build /etc/passwd /etc/passwd
COPY --from=build /etc/group /etc/group
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

USER appuser:appuser

ENTRYPOINT ["/userli-postfix-adapter"]
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
services:
adapter:
image: systemli/userli-postfix-adapter
build: .
ports:
- "10001:10001"
- "10002:10002"
- "10003:10003"
- "10004:10004"
- "10005:10005"
env_file:
- .env

0 comments on commit 896fe2f

Please sign in to comment.