added docker compose

This commit is contained in:
z1glr
2025-02-04 20:57:48 +01:00
parent 3f9a190795
commit 3227073470
14 changed files with 140 additions and 48 deletions

View File

@@ -10,7 +10,7 @@ RUN go mod download && go mod verify
# build the source-code
COPY backend .
RUN go build -ldflags "-s -w" -o dist/backend
RUN go build -ldflags "-s -w" -o dist/golunteer
# build the frontend
FROM node:current AS client-builder
@@ -29,19 +29,27 @@ FROM alpine:latest
WORKDIR /usr/bin/app
# copy the backend
COPY --from=backend-builder /usr/src/backend/dist/backend backend
COPY --from=backend-builder /usr/src/backend/dist/golunteer golunteer
COPY backend/setup.sql backend/tables.sql ./
# copy the client-html
COPY --from=client-builder /usr/src/client/out html
EXPOSE 80
# Create a group and user
RUN addgroup -S golunteer && adduser -S golunteer -G golunteer
EXPOSE 61016
EXPOSE 80
# create an empty config-file so that a bind doesn't create a directory
RUN touch config.yaml && chown -R golunteer:golunteer config.yaml
RUN mkdir data && chown -R golunteer:golunteer data
RUN mkdir logs && chown -R golunteer:golunteer logs
# copy the config-file
COPY backend/config-default.yaml .
# Tell docker that all future commands should run as the appuser user
USER golunteer
# run the app
CMD ["app"]
CMD ["./golunteer", "data/config.yaml"]