Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Ignore files not necessary for the Docker build
.git
.gitignore
*.md
testsheet.md
README.md

# Ignore development files
.vscode
.idea
*.swp
*.swo
*~

# Ignore build and unnecessary binaries
bin/windows/
*.exe

# Ignore Go files not necessary
*.go
go.mod
go.sum
cmd/
internal/

# Ignore test files
*_test.go
*.test

# Ignore local configuration files (if present)
.env
.env.local
.env.*.local

# Ignore other temporary files
*.log
*.tmp
.DS_Store
Thumbs.db

36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM alpine:latest

# Install dependencies
RUN apk --no-cache add ca-certificates libc6-compat

# Create a non-root user
RUN addgroup -g 1000 dcs && \
adduser -D -u 1000 -G dcs dcs

# Create working directory
WORKDIR /app

# Copy the executable
COPY bin/linux/DCS-API /app/DCS-API

# Verify that the file exists and set permissions
RUN ls -la /app/DCS-API && \
chmod +x /app/DCS-API && \
chown -R dcs:dcs /app

# Pass to the non-root user
USER dcs

# Define port as build argument with default value
ARG PORT=8080

# Set port as environment variable and expose it
ENV PORT=${PORT}
EXPOSE ${PORT}

# Note: Sensitive environment variables (e.g. GC_PRIVATE_KEY, GC_ADDRESS, GC_WALLET_GAS_ID, etc.)
# must be passed at runtime using --env-file or -e flags.

# Entrypoint to execute the application
ENTRYPOINT ["/app/DCS-API"]