Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
fix: docker
Browse files Browse the repository at this point in the history
  • Loading branch information
keshon committed Feb 25, 2024
1 parent da5420b commit 3c9a354
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# First stage: build the Go application
FROM golang:1.21.1-alpine3.17 AS mybuildstage
FROM golang:1.21.1-alpine3.17 AS build

RUN apk add --no-cache build-base
ADD src /usr/project
WORKDIR /usr/project

# Run a single command to set variables, remove .env file, and build the Go application
# Combine commands for better layer caching
RUN GO_VERSION=$(go version | awk '{print $3}') && \
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") && \
CGO_ENABLED=1 && \
rm -f .env && \
go build -o app -ldflags "-X 'github.com/keshon/melodix-discord-player/internal/version.BuildDate=${BUILD_DATE}' -X 'github.com/keshon/melodix-discord-player/internal/version.GoVersion=${GO_VERSION}'" cmd/main.go && \
mv melodix.db.empty melodix.db
touch database.db && \
apk del build-base && \
rm -rf /var/cache/apk/* && \
rm -rf /usr/share/man

# Second stage: create the final image
FROM alpine:3.17

RUN apk update && \
apk add --no-cache ffmpeg

COPY --from=mybuildstage /usr/project /usr/project
COPY --from=build /usr/project /usr/project

WORKDIR /usr/project

Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.traefik.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
networks:
- proxy
ports:
- 3034:8080
- 3035:8080
labels:
# HTTP to HTTPS redirection and middleware assignment
- traefik.enable=true
Expand Down

0 comments on commit 3c9a354

Please sign in to comment.