upda/Dockerfile
Varakh 19c367a5d8
All checks were successful
/ build (push) Successful in 3m22s
chore(docker,deps): updates and change docker base (#31)
- update gin/cors to 1.7.2
- change docker base to alpine 3.19 which requires an indirect dependency upgrade to sqlite3 as long as go-gorm/sqlite bundles the old version
Co-authored-by: Varakh <varakh@varakh.de>
Co-committed-by: Varakh <varakh@varakh.de>
2024-05-01 20:45:35 +00:00

49 lines
1.3 KiB
Docker

#
# Build image
#
FROM alpine:3.19 AS builder
LABEL maintainer="Varakh <varakh@varakh.de>"
RUN apk --update upgrade && \
apk add go gcc make sqlite && \
# See https://stackoverflow.com/questions/34729748/installed-go-binary-not-found-in-path-on-alpine-linux-docker
mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 && \
rm -rf /var/cache/apk/*
WORKDIR /app
COPY . .
RUN rm -rf bin/ && \
CC=gcc make ci
#
# Actual image
#
FROM alpine:3.19
LABEL maintainer="Varakh <varakh@varakh.de>" \
description="upda" \
org.opencontainers.image.authors="Varakh" \
org.opencontainers.image.revision="${REVISION}" \
org.opencontainers.image.vendor="Varakh" \
org.opencontainers.image.title="upda" \
org.opencontainers.image.description="upda" \
org.opencontainers.image.base.name="alpine:3.19"
ENV USER=appuser \
GROUP=appuser \
UID=2033 \
GID=2033
RUN apk --update upgrade && \
apk add sqlite tzdata && \
rm -rf /var/cache/apk/* && \
addgroup -S ${GROUP} -g ${GID} && \
adduser -S ${USER} -G ${GROUP} -u ${UID}
COPY --from=builder /app/bin/upda-cli-linux-amd64 /usr/bin/upda-cli
COPY --from=builder /app/bin/upda-server-linux-amd64 /usr/bin/upda-server
USER ${USER}
ENV SERVER_PORT 8080
EXPOSE ${SERVER_PORT}
CMD ["/usr/bin/upda-server"]