-
Notifications
You must be signed in to change notification settings - Fork 8
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
Showing
16 changed files
with
1,071 additions
and
802 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,3 +1,5 @@ | ||
smscsim | ||
*.swp | ||
|
||
.idea/ | ||
main.exe | ||
main |
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,21 +1,25 @@ | ||
FROM golang:1.13.15-alpine AS build | ||
FROM dart:3.1.3-sdk AS build | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN apk upgrade --update \ | ||
&& apk add -U tzdata \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& go build | ||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata \ | ||
&& dart compile exe main.dart -o smscsim | ||
|
||
########################################## | ||
|
||
FROM alpine:3.12.1 | ||
FROM scratch | ||
|
||
# copy necessary libs | ||
COPY --from=build /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so.2 | ||
COPY --from=build /lib/x86_64-linux-gnu/libpthread.so.0 /lib/x86_64-linux-gnu/libpthread.so.0 | ||
COPY --from=build /lib/x86_64-linux-gnu/libm.so.6 /lib/x86_64-linux-gnu/libm.so.6 | ||
COPY --from=build /lib/x86_64-linux-gnu/libc.so.6 /lib/x86_64-linux-gnu/libc.so.6 | ||
COPY --from=build /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 | ||
COPY --from=build /usr/share/zoneinfo /usr/share/zoneinfo | ||
|
||
# copy app itself | ||
COPY --from=build /app/smscsim /app/smscsim | ||
|
||
ENTRYPOINT ["/app/smscsim"] | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'dart:io'; | ||
|
||
import 'smsc.dart'; | ||
import 'web.dart'; | ||
|
||
final int DEF_SMSC_PORT = 2775; | ||
final int DEF_WEB_PORT = 12775; | ||
|
||
void main() { | ||
var env = Platform.environment; | ||
var smscPort = parseInt(env['SMSC_PORT'], DEF_SMSC_PORT); | ||
var webPort = parseInt(env['WEB_PORT'], DEF_WEB_PORT); | ||
var failedSubmits = parseBool(env['FAILED_SUBMITS'], false); | ||
|
||
var smsc = SmscServer(failedSubmits); | ||
smsc.start(smscPort); | ||
WebServer(smsc).start(webPort); | ||
} | ||
|
||
int parseInt(String? n, int def) { | ||
return int.tryParse(n ?? "$def") ?? def; | ||
} | ||
|
||
bool parseBool(String? b, bool def) { | ||
return bool.tryParse(b ?? "$def") ?? def; | ||
} |
Oops, something went wrong.