-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Parisa Samimi
committed
Mar 21, 2024
1 parent
d834987
commit c13d56f
Showing
3 changed files
with
14 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,11 @@ | ||
FROM golang:1.21 as build | ||
|
||
WORKDIR /dist | ||
COPY . . | ||
|
||
# Adjust the ARCH if needed - eg amd64 or arm64v8 | ||
ENV GOARCH=amd64 CGO_ENABLED=0 | ||
|
||
RUN go mod download | ||
|
||
# Build the binary | ||
RUN go build -v -o app ./main.go && chmod +x app | ||
|
||
FROM alpine:latest as production | ||
|
||
COPY --from=build /dist /usr/bin | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["app", "serve", "-port=80"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ services: | |
build: | ||
context: ./frontend | ||
dockerfile: Dockerfile | ||
target: develop | ||
depends_on: | ||
- app | ||
ports: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
FROM node:21.6-alpine3.18 | ||
|
||
WORKDIR /app | ||
|
||
FROM node:21.6-alpine3.18 AS base | ||
WORKDIR /opt/app | ||
COPY . . | ||
|
||
RUN npm install | ||
|
||
FROM base AS develop | ||
EXPOSE 3000 | ||
CMD ["npm", "run", "dev", '--host'] | ||
|
||
CMD npm run dev --host | ||
FROM base as build | ||
RUN npm run build | ||
|
||
FROM base as production | ||
WORKDIR /opt/app | ||
COPY --from=build /opt/app/.output . | ||
ENV NODE_ENV=production | ||
EXPOSE 3000 | ||
CMD ["node", "server/index.mjs"] |